mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Couple of bug fixes
This commit is contained in:
parent
bc4ce6e44a
commit
e24678fc31
11 changed files with 66 additions and 34 deletions
|
|
@ -327,10 +327,10 @@ def check_authentication():
|
|||
except:
|
||||
request.environ["PATH_INFO"] = "/error/401"
|
||||
else:
|
||||
if creds.count(':') != 1:
|
||||
if ':' not in creds:
|
||||
request.environ["PATH_INFO"] = "/error/401"
|
||||
else:
|
||||
username, password = creds.split(':')
|
||||
username, password = creds.split(':', 1)
|
||||
if username.strip() != (DataStore.username or "") or password.strip() != (DataStore.password or ""):
|
||||
request.environ["PATH_INFO"] = "/error/401"
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ import stat
|
|||
import string
|
||||
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.common import openFile
|
||||
from lib.core.compat import xrange
|
||||
from lib.core.convert import getUnicode
|
||||
from lib.core.data import logger
|
||||
from thirdparty.six import unichr as _unichr
|
||||
from lib.core.settings import PURGE_BLOCK_SIZE
|
||||
|
||||
def purge(directory):
|
||||
"""
|
||||
|
|
@ -46,12 +44,25 @@ def purge(directory):
|
|||
except:
|
||||
pass
|
||||
|
||||
logger.debug("writing random data to files")
|
||||
logger.debug("overwriting file contents")
|
||||
for filepath in filepaths:
|
||||
try:
|
||||
filesize = os.path.getsize(filepath)
|
||||
with openFile(filepath, "w+") as f:
|
||||
f.write("".join(_unichr(random.randint(0, 255)) for _ in xrange(filesize)))
|
||||
if filesize:
|
||||
# Note: NIST SP 800-88 ("Clear") / DoD 5220.22-M style multi-pass in-place overwrite
|
||||
# (zeros, ones, random) forcing each pass to disk; performed BEFORE the truncation below
|
||||
# so the original bytes are actually overwritten and not just released to free blocks.
|
||||
# Written in bounded blocks so peak memory stays O(PURGE_BLOCK_SIZE), not O(filesize)
|
||||
with open(filepath, "r+b") as f:
|
||||
for getBlock in (lambda n: b"\x00" * n, lambda n: b"\xff" * n, lambda n: os.urandom(n)):
|
||||
f.seek(0)
|
||||
remaining = filesize
|
||||
while remaining > 0:
|
||||
count = min(PURGE_BLOCK_SIZE, remaining)
|
||||
f.write(getBlock(count))
|
||||
remaining -= count
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class SQLAlchemy(GenericConnector):
|
|||
engine = _sqlalchemy.create_engine(self.address, connect_args={})
|
||||
|
||||
self.connector = engine.connect()
|
||||
except (TypeError, ValueError):
|
||||
except (TypeError, ValueError) as ex:
|
||||
if "_get_server_version_info" in traceback.format_exc():
|
||||
try:
|
||||
import pymssql
|
||||
|
|
@ -90,10 +90,14 @@ class SQLAlchemy(GenericConnector):
|
|||
raise SqlmapConnectionException("SQLAlchemy connection issue (obsolete version of pymssql ('%s') is causing problems)" % pymssql.__version__)
|
||||
except ImportError:
|
||||
pass
|
||||
# Note: surface (as a proper SqlmapConnectionException) instead of silently continuing with self.connector left None
|
||||
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % getSafeExString(ex))
|
||||
elif "invalid literal for int() with base 10: '0b" in traceback.format_exc():
|
||||
raise SqlmapConnectionException("SQLAlchemy connection issue ('https://bitbucket.org/zzzeek/sqlalchemy/issues/3975')")
|
||||
else:
|
||||
pass
|
||||
# Note: raise as SqlmapConnectionException (like the generic handler below) so the caller's native-connector
|
||||
# fallback engages and no raw TypeError/ValueError can reach sqlmap's top-level handler
|
||||
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % getSafeExString(ex))
|
||||
except SqlmapFilePathException:
|
||||
raise
|
||||
except Exception as ex:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue