mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a57c8e61a | ||
|
|
7d07976969 | ||
|
|
9dc1344478 | ||
|
|
e8e7d66356 | ||
|
|
2038512518 | ||
|
|
184454ba8e | ||
|
|
aacb360d46 | ||
|
|
5eaf1d2d27 | ||
|
|
be987815c9 | ||
|
|
fb3f428804 | ||
|
|
52f2faf2cf | ||
|
|
d5fb92ee42 | ||
|
|
cd76f8863b |
@@ -418,6 +418,11 @@ class Agent(object):
|
||||
payload = re.sub(r"(?i)\bMID\(", "SUBSTR(", payload)
|
||||
payload = re.sub(r"(?i)\bNCHAR\b", "CHAR", payload)
|
||||
|
||||
# NOTE: https://github.com/sqlmapproject/sqlmap/issues/5057
|
||||
match = re.search(r"(=0x)(303a303a)3(\d{2,})", payload)
|
||||
if match:
|
||||
payload = payload.replace(match.group(0), "%s%s%s" % (match.group(1), match.group(2).upper(), "".join("3%s" % _ for _ in match.group(3))))
|
||||
|
||||
return payload
|
||||
|
||||
def getComment(self, request):
|
||||
|
||||
@@ -16,7 +16,7 @@ _defaults = {
|
||||
"timeout": 30,
|
||||
"retries": 3,
|
||||
"csrfRetries": 0,
|
||||
"saFreq": 0,
|
||||
"safeFreq": 0,
|
||||
"threads": 1,
|
||||
"level": 1,
|
||||
"risk": 1,
|
||||
|
||||
@@ -433,7 +433,7 @@ def _setStdinPipeTargets():
|
||||
def next(self):
|
||||
try:
|
||||
line = next(conf.stdinPipe)
|
||||
except (IOError, OSError):
|
||||
except (IOError, OSError, TypeError):
|
||||
line = None
|
||||
|
||||
if line:
|
||||
|
||||
@@ -5,12 +5,7 @@ Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.data import logger
|
||||
from lib.core.settings import IS_WIN
|
||||
from lib.core.settings import PLATFORM
|
||||
|
||||
_readline = None
|
||||
|
||||
try:
|
||||
from readline import *
|
||||
import readline as _readline
|
||||
@@ -21,6 +16,10 @@ except:
|
||||
except:
|
||||
pass
|
||||
|
||||
from lib.core.data import logger
|
||||
from lib.core.settings import IS_WIN
|
||||
from lib.core.settings import PLATFORM
|
||||
|
||||
if IS_WIN and _readline:
|
||||
try:
|
||||
_outputfile = _readline.GetOutputFile()
|
||||
|
||||
@@ -20,7 +20,7 @@ from thirdparty import six
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.6.4.0"
|
||||
VERSION = "1.6.6.0"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
||||
@@ -119,6 +119,13 @@ def setDaemon(thread):
|
||||
def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardException=True, threadChoice=False, startThreadMsg=True):
|
||||
threads = []
|
||||
|
||||
def _threadFunction():
|
||||
try:
|
||||
threadFunction()
|
||||
finally:
|
||||
if conf.hashDB:
|
||||
conf.hashDB.close()
|
||||
|
||||
kb.multipleCtrlC = False
|
||||
kb.threadContinue = True
|
||||
kb.threadException = False
|
||||
@@ -154,14 +161,14 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
|
||||
infoMsg = "starting %d threads" % numThreads
|
||||
logger.info(infoMsg)
|
||||
else:
|
||||
threadFunction()
|
||||
_threadFunction()
|
||||
return
|
||||
|
||||
kb.multiThreadMode = True
|
||||
|
||||
# Start the threads
|
||||
for numThread in xrange(numThreads):
|
||||
thread = threading.Thread(target=exceptionHandledFunction, name=str(numThread), args=[threadFunction])
|
||||
thread = threading.Thread(target=exceptionHandledFunction, name=str(numThread), args=[_threadFunction])
|
||||
|
||||
setDaemon(thread)
|
||||
|
||||
|
||||
@@ -922,6 +922,8 @@ class Connect(object):
|
||||
|
||||
socket.setdefaulttimeout(conf.timeout)
|
||||
|
||||
# Dirty patch for Python3.11.0a7 (e.g. https://github.com/sqlmapproject/sqlmap/issues/5091)
|
||||
if not sys.version.startswith("3.11."):
|
||||
if conf.retryOn and re.search(conf.retryOn, page, re.I):
|
||||
if threadData.retriesCount < conf.retries:
|
||||
warnMsg = "forced retry of the request because of undesired page content"
|
||||
|
||||
@@ -126,6 +126,8 @@ def crawl(target, post=None, cookie=None):
|
||||
pass
|
||||
except ValueError: # for non-valid links
|
||||
pass
|
||||
except AssertionError: # for invalid HTML
|
||||
pass
|
||||
finally:
|
||||
if conf.forms:
|
||||
threadData.shared.formsFound |= len(findPageForms(content, current, False, True)) > 0
|
||||
|
||||
@@ -12,6 +12,13 @@ try:
|
||||
except: # removed ImportError because of https://github.com/sqlmapproject/sqlmap/issues/3171
|
||||
from thirdparty.fcrypt.fcrypt import crypt
|
||||
|
||||
try:
|
||||
from Crypto.Cipher.DES import MODE_CBC as CBC
|
||||
from Crypto.Cipher.DES import new as des
|
||||
except:
|
||||
from thirdparty.pydes.pyDes import CBC
|
||||
from thirdparty.pydes.pyDes import des
|
||||
|
||||
_multiprocessing = None
|
||||
|
||||
import base64
|
||||
@@ -80,8 +87,6 @@ from lib.core.settings import UNICODE_ENCODING
|
||||
from lib.core.wordlist import Wordlist
|
||||
from thirdparty import six
|
||||
from thirdparty.colorama.initialise import init as coloramainit
|
||||
from thirdparty.pydes.pyDes import CBC
|
||||
from thirdparty.pydes.pyDes import des
|
||||
from thirdparty.six.moves import queue as _queue
|
||||
|
||||
def mysql_passwd(password, uppercase=True):
|
||||
@@ -219,10 +224,17 @@ def oracle_old_passwd(password, username, uppercase=True): # prior to version '
|
||||
'F894844C34402B67'
|
||||
"""
|
||||
|
||||
IV, pad = "\0" * 8, "\0"
|
||||
IV, pad = b"\0" * 8, b"\0"
|
||||
|
||||
unistr = b"".join((b"\0" + _.encode(UNICODE_ENCODING)) if ord(_) < 256 else _.encode(UNICODE_ENCODING) for _ in (username + password).upper())
|
||||
|
||||
if des.__module__ == "Crypto.Cipher.DES":
|
||||
unistr += b"\0" * ((8 - len(unistr) % 8) & 7)
|
||||
cipher = des(decodeHex("0123456789ABCDEF"), CBC, iv=IV)
|
||||
encrypted = cipher.encrypt(unistr)
|
||||
cipher = des(encrypted[-8:], CBC, iv=IV)
|
||||
encrypted = cipher.encrypt(unistr)
|
||||
else:
|
||||
cipher = des(decodeHex("0123456789ABCDEF"), CBC, IV, pad)
|
||||
encrypted = cipher.encrypt(unistr)
|
||||
cipher = des(encrypted[-8:], CBC, IV, pad)
|
||||
|
||||
@@ -62,6 +62,7 @@ class HashDB(object):
|
||||
threadData = getCurrentThreadData()
|
||||
try:
|
||||
if threadData.hashDBCursor:
|
||||
threadData.hashDBCursor.connection.commit()
|
||||
threadData.hashDBCursor.close()
|
||||
threadData.hashDBCursor.connection.close()
|
||||
threadData.hashDBCursor = None
|
||||
@@ -197,6 +198,10 @@ class HashDB(object):
|
||||
threadData.inTransaction = False
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
except sqlite3.ProgrammingError:
|
||||
self.cursor = None
|
||||
threadData.inTransaction = False
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
18
sqlmap.py
18
sqlmap.py
@@ -338,6 +338,12 @@ def main():
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif "invalid maximum character passed to PyUnicode_New" in excMsg and re.search(r"\A3\.[34]", sys.version) is not None:
|
||||
errMsg = "please upgrade the Python version (>= 3.5) "
|
||||
errMsg += "(Reference: 'https://bugs.python.org/issue18183')"
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("scramble_caching_sha2", "TypeError")):
|
||||
errMsg = "please downgrade the 'PyMySQL' package (=< 0.8.1) "
|
||||
errMsg += "(Reference: 'https://github.com/PyMySQL/PyMySQL/issues/700')"
|
||||
@@ -363,6 +369,12 @@ def main():
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif "AttributeError: unable to access item" in excMsg and re.search(r"3\.11\.\d+a", sys.version):
|
||||
errMsg = "there is a known issue when sqlmap is run with ALPHA versions of Python 3.11. "
|
||||
errMsg += "Please downgrade to some stable Python version"
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("Resource temporarily unavailable", "os.fork()", "dictionaryAttack")):
|
||||
errMsg = "there has been a problem while running the multiprocessing hash cracking. "
|
||||
errMsg += "Please rerun with option '--threads=1'"
|
||||
@@ -446,6 +458,12 @@ def main():
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("PermissionError: [WinError 5]", "multiprocessing")):
|
||||
errMsg = "there is a permission problem in running multiprocessing on this system. "
|
||||
errMsg += "Please rerun with '--disable-multi'"
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
|
||||
elif all(_ in excMsg for _ in ("No such file", "_'")):
|
||||
errMsg = "corrupted installation detected ('%s'). " % excMsg.strip().split('\n')[-1]
|
||||
errMsg += "You should retrieve the latest development version from official GitHub "
|
||||
|
||||
2
thirdparty/six/__init__.py
vendored
2
thirdparty/six/__init__.py
vendored
@@ -263,7 +263,7 @@ _moved_attributes = [
|
||||
MovedAttribute("reduce", "__builtin__", "functools"),
|
||||
MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
|
||||
MovedAttribute("StringIO", "StringIO", "io"),
|
||||
MovedAttribute("UserDict", "UserDict", "collections"),
|
||||
MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"),
|
||||
MovedAttribute("UserList", "UserList", "collections"),
|
||||
MovedAttribute("UserString", "UserString", "collections"),
|
||||
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
|
||||
|
||||
Reference in New Issue
Block a user