mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-12 02:22:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66e07dfab6 | ||
|
|
226d467f6d | ||
|
|
ea5ae44b6c | ||
|
|
95b9a47c6f | ||
|
|
e05f65628d | ||
|
|
609545176f | ||
|
|
8de4820b24 | ||
|
|
df5fabbbbb | ||
|
|
0c48d0dbec | ||
|
|
5108c2d06c | ||
|
|
603d602550 | ||
|
|
907786edb8 | ||
|
|
85b73f872e | ||
|
|
a42ec7d9cb | ||
|
|
b3f4c6d0fc | ||
|
|
cec65f3a27 | ||
|
|
cc79ae69aa | ||
|
|
5a9dc15cf2 | ||
|
|
f1fd080ba5 | ||
|
|
cfe9fb4f5b | ||
|
|
7a55c9c145 | ||
|
|
4077a359f4 | ||
|
|
435fd49f1d | ||
|
|
bcfd9c3f48 |
@@ -1,7 +1,7 @@
|
||||
Due to the anti-virus positive detection of shell scripts stored inside this folder, we needed to somehow circumvent this. As from the plain sqlmap users perspective nothing has to be done prior to their usage by sqlmap, but if you want to have access to their original source code use the decrypt functionality of the ../extra/cloak/cloak.py utility.
|
||||
Due to the anti-virus positive detection of shell scripts stored inside this folder, we needed to somehow circumvent this. As from the plain sqlmap users perspective nothing has to be done prior to their usage by sqlmap, but if you want to have access to their original source code use the decrypt functionality of the ../../extra/cloak/cloak.py utility.
|
||||
|
||||
To prepare the original scripts to the cloaked form use this command:
|
||||
find backdoors/backdoor.* stagers/stager.* -type f -exec python ../extra/cloak/cloak.py -i '{}' \;
|
||||
find backdoors/backdoor.* stagers/stager.* -type f -exec python ../../extra/cloak/cloak.py -i '{}' \;
|
||||
|
||||
To get back them into the original form use this:
|
||||
find backdoors/backdoor.*_ stagers/stager.*_ -type f -exec python ../extra/cloak/cloak.py -d -i '{}' \;
|
||||
find backdoors/backdoor.*_ stagers/stager.*_ -type f -exec python ../../extra/cloak/cloak.py -d -i '{}' \;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
:ЫХ&%╦С_m⌠D╗в?Е▓>и╠gI╛ё╠/З∙щб" ▄FщFчRs.k п⌡dqИЮa┌XЬ[°┘╧Юбlс5╖ZШйв∙⌠▄%Eч:+b≈м┬m╫Eк
|
||||
У╟╢?Чl┘м╟lw╤с(Б▌-Б&_Бk{╒],T╕ъЮШНгC╝\ba╛ik@bL6EХztФ©╠{■▐[дO╟]I~IlИX6└≤.щё²EЦS_б≥iОeKеxH2n╒дХCf┼CХ╓█ЬN╪БП5╒~ [ы,З 7ЩЩ=Ж;хЙ╛Ю+°Qюxt}zтq?╠·9ГUСЯSВУ>hvЯй╢М5gДW÷S=Н▓%√t"dЮ╒с╢wОnALg╛б▀ё$вО│ЁУ│э│ф╢Sок_ЕyJ╔Y┌Ч2У╫]╜;K;╚╞"√²6py|╙╡╟Х'*┌ ²)+.K┌у,R╬d(~U·│Ы6г9└▌b+аLi╪Ш©x
°Т`АЩ┘╧X┤>~н╙zE÷√НЪИР┤gХ└├╓f·Nб■К╠P{═▀$▌▀─e%<╒З╫У╩Sвв├┌$2#├╟P{╞╞Ф]╧├Ио└*⌠@°╔ж]╪kE
|
||||
5Ó×<Ùñ\Íh�†i•å1ãŽUPÍ¡²=¤¹è“^R~ƒlâtÇ3q-yÄü®5RžÊ^°A™YŸ—çÌ÷F:£B¨pÄøÎj—�ž{'$ˆJ\m½ò,‘¿FÙTÙ6áânHñFºÿ©
uµÁvλ|U’QPÈT"bÃ_/FøóÕª¸·4¡v]SµiCp8Z˜
{Ì€ƒbõ�XÖœ A9 FFÖj/å›pñ–Ì“x\uý«pŽgH×&d?ô~³çiY¸f"ê§Ÿ¦b‰³¦EÕq#dëMø#%£Ñ§m¸�£Ê®H¡zw#Vá iÁé6ÍjÁèdPå«]'§ºÃÇ
|
||||
Uý6�P/°¾Ç"Rïˆì†nŽlB^9€÷ÚõT ૌǘ½ƒÅê 0™»(êS>x¼8�ìlÙˆûK<41”�;÷Ÿ5b'PŸãæ˜P%¨¯0J,H�‹9èw'Tj¬˜˜4Ä+Ú¢/3L[¶CCƒ(âÞzŽªLÔ¬ÓÉ/ˆAü³Gœ„°Óܣџ‹¬&–ÿMÐÊÇ„-Ðü+¤´²'?üÖˆB£Ë$Ø.è´ã&O׿ …�ÔDØ„êÝÚ¦ÊÕ¡R(ƒY\
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -83,7 +83,7 @@
|
||||
<error regexp="CLI Driver.*?DB2"/>
|
||||
<error regexp="DB2 SQL error"/>
|
||||
<error regexp="\bdb2_\w+\("/>
|
||||
<error regexp="SQLSTATE.+SQLCODE"/>
|
||||
<error regexp="SQLCODE[=:\d, -]+SQLSTATE"/>
|
||||
<error regexp="com\.ibm\.db2\.jcc"/>
|
||||
<error regexp="Zend_Db_(Adapter|Statement)_Db2_Exception"/>
|
||||
<error regexp="Pdo[./_\\]Ibm"/>
|
||||
|
||||
@@ -32,7 +32,7 @@ Pour afficher une liste complète des options et des commutateurs (switches), ta
|
||||
|
||||
python sqlmap.py -hh
|
||||
|
||||
Vous pouvez regarder un vidéo [ici](https://asciinema.org/a/46601) pour plus d'exemples.
|
||||
Vous pouvez regarder une vidéo [ici](https://asciinema.org/a/46601) pour plus d'exemples.
|
||||
Pour obtenir un aperçu des ressources de __sqlmap__, une liste des fonctionnalités prises en charge, la description de toutes les options, ainsi que des exemples, nous vous recommandons de consulter [le wiki](https://github.com/sqlmapproject/sqlmap/wiki/Usage).
|
||||
|
||||
Liens
|
||||
|
||||
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 0):
|
||||
xrange = range
|
||||
ord = lambda _: _
|
||||
|
||||
KEY = b"Beeth7hoyooleeF0"
|
||||
KEY = b"MOZFqVjlk1CY436G"
|
||||
|
||||
def xor(message, key):
|
||||
return b"".join(struct.pack('B', ord(message[i]) ^ ord(key[i % len(key)])) for i in range(len(message)))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# NOTE: this script is for dev usage after AV something something
|
||||
|
||||
DIR=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
|
||||
|
||||
cd $DIR/../..
|
||||
for file in $(find -regex ".*\.[a-z]*_" -type f | grep -v wordlist); do python extra/cloak/cloak.py -d -i $file; done
|
||||
|
||||
cd $DIR/../cloak
|
||||
sed -i 's/KEY = .*/KEY = b"'`python -c 'import random; import string; print("".join(random.sample(string.ascii_letters + string.digits, 16)))'`'"/g' cloak.py
|
||||
|
||||
cd $DIR/../..
|
||||
for file in $(find -regex ".*\.[a-z]*_" -type f | grep -v wordlist); do python extra/cloak/cloak.py -i `echo $file | sed 's/_$//g'`; done
|
||||
|
||||
git clean -f > /dev/null
|
||||
@@ -1581,7 +1581,7 @@ def checkConnection(suppressOutput=False):
|
||||
kb.originalPage = kb.pageTemplate = threadData.lastPage
|
||||
kb.originalCode = threadData.lastCode
|
||||
|
||||
if conf.cj and not conf.cookie and not conf.dropSetCookie:
|
||||
if conf.cj and not conf.cookie and not any(_[0] == HTTP_HEADER.COOKIE for _ in conf.httpHeaders) and not conf.dropSetCookie:
|
||||
candidate = DEFAULT_COOKIE_DELIMITER.join("%s=%s" % (_.name, _.value) for _ in conf.cj)
|
||||
|
||||
message = "you have not declared cookie(s), while "
|
||||
|
||||
+6
-2
@@ -183,8 +183,12 @@ class Agent(object):
|
||||
newValue = self.adjustLateValues(newValue)
|
||||
|
||||
# TODO: support for POST_HINT
|
||||
newValue = encodeBase64(newValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
||||
origValue = encodeBase64(origValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
||||
newValue = encodeBase64(newValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING, safe=conf.base64Safe)
|
||||
|
||||
if parameter in kb.base64Originals:
|
||||
origValue = kb.base64Originals[parameter]
|
||||
else:
|
||||
origValue = encodeBase64(origValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
||||
|
||||
if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER):
|
||||
_ = "%s%s" % (origValue, kb.customInjectionMark)
|
||||
|
||||
+64
-4
@@ -631,7 +631,7 @@ def paramToDict(place, parameters=None):
|
||||
|
||||
if parameter in (conf.base64Parameter or []):
|
||||
try:
|
||||
oldValue = value
|
||||
kb.base64Originals[parameter] = oldValue = value
|
||||
value = decodeBase64(value, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
||||
parameters = re.sub(r"\b%s(\b|\Z)" % re.escape(oldValue), value, parameters)
|
||||
except:
|
||||
@@ -1051,6 +1051,16 @@ def dataToDumpFile(dumpFile, data):
|
||||
raise
|
||||
|
||||
def dataToOutFile(filename, data):
|
||||
"""
|
||||
Saves data to filename
|
||||
|
||||
>>> pushValue(conf.get("filePath"))
|
||||
>>> conf.filePath = tempfile.gettempdir()
|
||||
>>> "_etc_passwd" in dataToOutFile("/etc/passwd", b":::*")
|
||||
True
|
||||
>>> conf.filePath = popValue()
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
|
||||
if data:
|
||||
@@ -1348,7 +1358,7 @@ def banner():
|
||||
if not any(_ in sys.argv for _ in ("--version", "--api")) and not conf.get("disableBanner"):
|
||||
result = BANNER
|
||||
|
||||
if not IS_TTY or "--disable-coloring" in sys.argv:
|
||||
if not IS_TTY or any(_ in sys.argv for _ in ("--disable-coloring", "--disable-colouring")):
|
||||
result = clearColors(result)
|
||||
elif IS_WIN:
|
||||
coloramainit()
|
||||
@@ -1714,6 +1724,11 @@ def escapeJsonValue(value):
|
||||
Escapes JSON value (used in payloads)
|
||||
|
||||
# Reference: https://stackoverflow.com/a/16652683
|
||||
|
||||
>>> "\\n" in escapeJsonValue("foo\\nbar")
|
||||
False
|
||||
>>> "\\\\t" in escapeJsonValue("foo\\tbar")
|
||||
True
|
||||
"""
|
||||
|
||||
retVal = ""
|
||||
@@ -1888,6 +1903,12 @@ def getLocalIP():
|
||||
def getRemoteIP():
|
||||
"""
|
||||
Get remote/target IP address
|
||||
|
||||
>>> pushValue(conf.hostname)
|
||||
>>> conf.hostname = "localhost"
|
||||
>>> getRemoteIP() == "127.0.0.1"
|
||||
True
|
||||
>>> conf.hostname = popValue()
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
@@ -2014,6 +2035,9 @@ def normalizePath(filepath):
|
||||
def safeFilepathEncode(filepath):
|
||||
"""
|
||||
Returns filepath in (ASCII) format acceptable for OS handling (e.g. reading)
|
||||
|
||||
>>> 'sqlmap' in safeFilepathEncode(paths.SQLMAP_HOME_PATH)
|
||||
True
|
||||
"""
|
||||
|
||||
retVal = filepath
|
||||
@@ -2220,6 +2244,15 @@ def isHexEncodedString(subject):
|
||||
def isMultiThreadMode():
|
||||
"""
|
||||
Checks if running in multi-thread(ing) mode
|
||||
|
||||
>>> isMultiThreadMode()
|
||||
False
|
||||
>>> _ = lambda: time.sleep(0.1)
|
||||
>>> thread = threading.Thread(target=_)
|
||||
>>> thread.daemon = True
|
||||
>>> thread.start()
|
||||
>>> isMultiThreadMode()
|
||||
True
|
||||
"""
|
||||
|
||||
return threading.activeCount() > 1
|
||||
@@ -2228,6 +2261,9 @@ def isMultiThreadMode():
|
||||
def getConsoleWidth(default=80):
|
||||
"""
|
||||
Returns console width
|
||||
|
||||
>>> any((getConsoleWidth(), True))
|
||||
True
|
||||
"""
|
||||
|
||||
width = None
|
||||
@@ -2434,6 +2470,9 @@ def initCommonOutputs():
|
||||
def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, unique=False):
|
||||
"""
|
||||
Returns newline delimited items contained inside file
|
||||
|
||||
>>> "SELECT" in getFileItems(paths.SQL_KEYWORDS)
|
||||
True
|
||||
"""
|
||||
|
||||
retVal = list() if not unique else OrderedDict()
|
||||
@@ -2540,8 +2579,8 @@ def goGoodSamaritan(prevValue, originalCharset):
|
||||
|
||||
def getPartRun(alias=True):
|
||||
"""
|
||||
Goes through call stack and finds constructs matching conf.dbmsHandler.*.
|
||||
Returns it or its alias used in 'txt/common-outputs.txt'
|
||||
Goes through call stack and finds constructs matching
|
||||
conf.dbmsHandler.*. Returns it or its alias used in 'txt/common-outputs.txt'
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
@@ -4964,6 +5003,14 @@ def decloakToTemp(filename):
|
||||
>>> openFile(_, "rb", encoding=None).read().startswith(b'<%')
|
||||
True
|
||||
>>> os.remove(_)
|
||||
>>> _ = decloakToTemp(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.asp_"))
|
||||
>>> openFile(_, "rb", encoding=None).read().startswith(b'<%')
|
||||
True
|
||||
>>> os.remove(_)
|
||||
>>> _ = decloakToTemp(os.path.join(paths.SQLMAP_UDF_PATH, "postgresql", "linux", "64", "11", "lib_postgresqludf_sys.so_"))
|
||||
>>> b'sys_eval' in openFile(_, "rb", encoding=None).read()
|
||||
True
|
||||
>>> os.remove(_)
|
||||
"""
|
||||
|
||||
content = decloak(filename)
|
||||
@@ -4997,6 +5044,12 @@ def getRequestHeader(request, name):
|
||||
Solving an issue with an urllib2 Request header case sensitivity
|
||||
|
||||
# Reference: http://bugs.python.org/issue2275
|
||||
|
||||
>>> _ = lambda _: _
|
||||
>>> _.headers = {"FOO": "BAR"}
|
||||
>>> _.header_items = lambda: _.headers.items()
|
||||
>>> getText(getRequestHeader(_, "foo"))
|
||||
'BAR'
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
@@ -5094,6 +5147,13 @@ def pollProcess(process, suppress_errors=False):
|
||||
def parseRequestFile(reqFile, checkParams=True):
|
||||
"""
|
||||
Parses WebScarab and Burp logs and adds results to the target URL list
|
||||
|
||||
>>> handle, reqFile = tempfile.mkstemp(suffix=".req")
|
||||
>>> content = b"POST / HTTP/1.0\\nUser-agent: foobar\\nHost: www.example.com\\n\\nid=1\\n"
|
||||
>>> _ = os.write(handle, content)
|
||||
>>> os.close(handle)
|
||||
>>> next(parseRequestFile(reqFile)) == ('http://www.example.com:80/', 'POST', 'id=1', None, (('User-agent', 'foobar'), ('Host', 'www.example.com')))
|
||||
True
|
||||
"""
|
||||
|
||||
def _parseWebScarabLog(content):
|
||||
|
||||
+35
-3
@@ -198,6 +198,8 @@ def decodeBase64(value, binary=True, encoding=None):
|
||||
True
|
||||
>>> decodeBase64("MTIz", binary=False)
|
||||
'123'
|
||||
>>> decodeBase64("A-B_CDE") == decodeBase64("A+B/CDE")
|
||||
True
|
||||
>>> decodeBase64(b"MTIzNA") == b"1234"
|
||||
True
|
||||
>>> decodeBase64("MTIzNA") == b"1234"
|
||||
@@ -206,12 +208,22 @@ def decodeBase64(value, binary=True, encoding=None):
|
||||
True
|
||||
"""
|
||||
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
padding = b'=' if isinstance(value, bytes) else '='
|
||||
|
||||
# Reference: https://stackoverflow.com/a/49459036
|
||||
if not value.endswith(padding):
|
||||
value += 3 * padding
|
||||
|
||||
# Reference: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
# Reference: https://perldoc.perl.org/MIME/Base64.html
|
||||
if isinstance(value, bytes):
|
||||
value = value.replace(b'-', b'+').replace(b'_', b'/')
|
||||
else:
|
||||
value = value.replace('-', '+').replace('_', '/')
|
||||
|
||||
retVal = base64.b64decode(value)
|
||||
|
||||
if not binary:
|
||||
@@ -219,16 +231,23 @@ def decodeBase64(value, binary=True, encoding=None):
|
||||
|
||||
return retVal
|
||||
|
||||
def encodeBase64(value, binary=True, encoding=None):
|
||||
def encodeBase64(value, binary=True, encoding=None, padding=True, safe=False):
|
||||
"""
|
||||
Returns a decoded representation of provided Base64 value
|
||||
|
||||
>>> encodeBase64(b"123") == b"MTIz"
|
||||
True
|
||||
>>> encodeBase64(u"123", binary=False)
|
||||
'MTIz'
|
||||
>>> encodeBase64(u"1234", binary=False)
|
||||
'MTIzNA=='
|
||||
>>> encodeBase64(u"1234", binary=False, padding=False)
|
||||
'MTIzNA'
|
||||
>>> encodeBase64(decodeBase64("A-B_CDE"), binary=False, safe=True)
|
||||
'A-B_CDE'
|
||||
"""
|
||||
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
if isinstance(value, six.text_type):
|
||||
value = value.encode(encoding or UNICODE_ENCODING)
|
||||
|
||||
@@ -237,6 +256,19 @@ def encodeBase64(value, binary=True, encoding=None):
|
||||
if not binary:
|
||||
retVal = getText(retVal, encoding)
|
||||
|
||||
if safe:
|
||||
padding = False
|
||||
|
||||
# Reference: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
# Reference: https://perldoc.perl.org/MIME/Base64.html
|
||||
if isinstance(retVal, bytes):
|
||||
retVal = retVal.replace(b'+', b'-').replace(b'/', b'_')
|
||||
else:
|
||||
retVal = retVal.replace('+', '-').replace('/', '_')
|
||||
|
||||
if not padding:
|
||||
retVal = retVal.rstrip(b'=' if isinstance(retVal, bytes) else '=')
|
||||
|
||||
return retVal
|
||||
|
||||
def getBytes(value, encoding=None, errors="strict", unsafe=True):
|
||||
|
||||
+4
-2
@@ -1856,6 +1856,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.arch = None
|
||||
kb.authHeader = None
|
||||
kb.bannerFp = AttribDict()
|
||||
kb.base64Originals = {}
|
||||
kb.binaryField = False
|
||||
kb.browserVerification = None
|
||||
|
||||
@@ -2008,10 +2009,11 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.skipSeqMatcher = False
|
||||
kb.smokeMode = False
|
||||
kb.reduceTests = None
|
||||
kb.tlsSNI = {}
|
||||
kb.sslSuccess = False
|
||||
kb.stickyDBMS = False
|
||||
kb.storeHashesChoice = None
|
||||
kb.suppressResumeInfo = False
|
||||
kb.tableExistsChoice = None
|
||||
kb.tableFrom = None
|
||||
kb.technique = None
|
||||
kb.tempDir = None
|
||||
@@ -2021,7 +2023,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.testType = None
|
||||
kb.threadContinue = True
|
||||
kb.threadException = False
|
||||
kb.tableExistsChoice = None
|
||||
kb.tlsSNI = {}
|
||||
kb.uChar = NULL
|
||||
kb.udfFail = False
|
||||
kb.unionDuplicates = False
|
||||
|
||||
@@ -203,6 +203,7 @@ optDict = {
|
||||
"answers": "string",
|
||||
"batch": "boolean",
|
||||
"base64Parameter": "string",
|
||||
"base64Safe": "boolean",
|
||||
"binaryFields": "string",
|
||||
"charset": "string",
|
||||
"checkInternet": "boolean",
|
||||
|
||||
@@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import codecs
|
||||
import os
|
||||
import random
|
||||
|
||||
import lib.controller.checks
|
||||
@@ -76,6 +77,15 @@ def dirtyPatches():
|
||||
# to prevent too much "guessing" in case of binary data retrieval
|
||||
thirdparty.chardet.universaldetector.MINIMUM_THRESHOLD = 0.90
|
||||
|
||||
# https://github.com/sqlmapproject/sqlmap/issues/4314
|
||||
try:
|
||||
os.urandom(1)
|
||||
except NotImplemented:
|
||||
if six.PY3:
|
||||
os.urandom = lambda size: bytes(random.randint(0, 255) for _ in range(size))
|
||||
else:
|
||||
os.urandom = lambda size: "".join(chr(random.randint(0, 255)) for _ in xrange(size))
|
||||
|
||||
def resolveCrossReferences():
|
||||
"""
|
||||
Place for cross-reference resolution
|
||||
|
||||
@@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.4.8.0"
|
||||
VERSION = "1.4.9.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)
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ def _setRequestParams():
|
||||
def process(match, repl):
|
||||
retVal = match.group(0)
|
||||
|
||||
if not (conf.testParameter and match.group("name") not in [removePostHintPrefix(_) for _ in conf.testParameter]) and match.group("name") == match.group("name").strip('\\'):
|
||||
if not (conf.testParameter and match.group("name") not in (removePostHintPrefix(_) for _ in conf.testParameter)) and match.group("name") == match.group("name").strip('\\'):
|
||||
retVal = repl
|
||||
while True:
|
||||
_ = re.search(r"\\g<([^>]+)>", retVal)
|
||||
@@ -400,7 +400,7 @@ def _setRequestParams():
|
||||
raise SqlmapGenericException(errMsg)
|
||||
|
||||
if conf.csrfToken:
|
||||
if not any(re.search(conf.csrfToken, ' '.join(_), re.I) for _ in (conf.paramDict.get(PLACE.GET, {}), conf.paramDict.get(PLACE.POST, {}), conf.paramDict.get(PLACE.COOKIE, {}))) and not re.search(r"\b%s\b" % conf.csrfToken, conf.data or "") and conf.csrfToken not in set(_[0].lower() for _ in conf.httpHeaders) and conf.csrfToken not in conf.paramDict.get(PLACE.COOKIE, {}):
|
||||
if not any(re.search(conf.csrfToken, ' '.join(_), re.I) for _ in (conf.paramDict.get(PLACE.GET, {}), conf.paramDict.get(PLACE.POST, {}), conf.paramDict.get(PLACE.COOKIE, {}))) and not re.search(r"\b%s\b" % conf.csrfToken, conf.data or "") and conf.csrfToken not in set(_[0].lower() for _ in conf.httpHeaders) and conf.csrfToken not in conf.paramDict.get(PLACE.COOKIE, {}) and not all(re.search(conf.csrfToken, _, re.I) for _ in conf.paramDict.get(PLACE.URI, {}).values()):
|
||||
errMsg = "anti-CSRF token parameter '%s' not " % conf.csrfToken._original
|
||||
errMsg += "found in provided GET, POST, Cookie or header values"
|
||||
raise SqlmapGenericException(errMsg)
|
||||
|
||||
+18
-7
@@ -622,6 +622,9 @@ def cmdLineParser(argv=None):
|
||||
general.add_argument("--base64", dest="base64Parameter",
|
||||
help="Parameter(s) containing Base64 encoded data")
|
||||
|
||||
general.add_argument("--base64-safe", dest="base64Safe", action="store_true",
|
||||
help="Use URL and filename safe Base64 alphabet")
|
||||
|
||||
general.add_argument("--batch", dest="batch", action="store_true",
|
||||
help="Never ask for user input, use the default behavior")
|
||||
|
||||
@@ -860,7 +863,7 @@ def cmdLineParser(argv=None):
|
||||
_ = []
|
||||
advancedHelp = True
|
||||
extraHeaders = []
|
||||
tamperIndex = None
|
||||
auxIndexes = {}
|
||||
|
||||
# Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
|
||||
for arg in argv:
|
||||
@@ -949,17 +952,25 @@ def cmdLineParser(argv=None):
|
||||
argv[i] = ""
|
||||
elif argv[i] in DEPRECATED_OPTIONS:
|
||||
argv[i] = ""
|
||||
elif argv[i].startswith("--tamper"):
|
||||
if tamperIndex is None:
|
||||
tamperIndex = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None)
|
||||
elif any(argv[i].startswith(_) for _ in ("--tamper",)):
|
||||
key = re.search(r"\-\-(\w+)", argv[i]).group(1)
|
||||
index = auxIndexes.get(key, None)
|
||||
if index is None:
|
||||
index = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None)
|
||||
auxIndexes[key] = index
|
||||
else:
|
||||
argv[tamperIndex] = "%s,%s" % (argv[tamperIndex], argv[i].split('=')[1] if '=' in argv[i] else (argv[i + 1] if i + 1 < len(argv) and not argv[i + 1].startswith('-') else ""))
|
||||
delimiter = ','
|
||||
argv[index] = "%s%s%s" % (argv[index], delimiter, argv[i].split('=')[1] if '=' in argv[i] else (argv[i + 1] if i + 1 < len(argv) and not argv[i + 1].startswith('-') else ""))
|
||||
argv[i] = ""
|
||||
elif argv[i] in ("-H", "--header"):
|
||||
if i + 1 < len(argv):
|
||||
elif argv[i] in ("-H", "--header") or any(argv[i].startswith("%s=" % _) for _ in ("-H", "--header")):
|
||||
if '=' in argv[i]:
|
||||
extraHeaders.append(argv[i].split('=', 1)[1])
|
||||
elif i + 1 < len(argv):
|
||||
extraHeaders.append(argv[i + 1])
|
||||
elif argv[i] == "--deps":
|
||||
argv[i] = "--dependencies"
|
||||
elif argv[i] == "--disable-colouring":
|
||||
argv[i] = "--disable-coloring"
|
||||
elif argv[i] == "-r":
|
||||
for j in xrange(i + 2, len(argv)):
|
||||
value = argv[j]
|
||||
|
||||
@@ -394,7 +394,7 @@ def processResponse(page, responseHeaders, code=None, status=None):
|
||||
if msg:
|
||||
logger.warning("parsed DBMS error message: '%s'" % msg.rstrip('.'))
|
||||
|
||||
if kb.processResponseCounter < IDENTYWAF_PARSE_LIMIT:
|
||||
if not conf.skipWaf and kb.processResponseCounter < IDENTYWAF_PARSE_LIMIT:
|
||||
rawResponse = "%s %s %s\n%s\n%s" % (_http_client.HTTPConnection._http_vsn_str, code or "", status or "", getUnicode("".join(responseHeaders.headers if responseHeaders else [])), page)
|
||||
|
||||
identYwaf.non_blind.clear()
|
||||
|
||||
@@ -539,7 +539,7 @@ class Connect(object):
|
||||
conn = _urllib.request.urlopen(req)
|
||||
|
||||
if not kb.authHeader and getRequestHeader(req, HTTP_HEADER.AUTHORIZATION) and (conf.authType or "").lower() == AUTH_TYPE.BASIC.lower():
|
||||
kb.authHeader = getRequestHeader(req, HTTP_HEADER.AUTHORIZATION)
|
||||
kb.authHeader = getUnicode(getRequestHeader(req, HTTP_HEADER.AUTHORIZATION))
|
||||
|
||||
if not kb.proxyAuthHeader and getRequestHeader(req, HTTP_HEADER.PROXY_AUTHORIZATION):
|
||||
kb.proxyAuthHeader = getRequestHeader(req, HTTP_HEADER.PROXY_AUTHORIZATION)
|
||||
@@ -1125,11 +1125,13 @@ class Connect(object):
|
||||
if token:
|
||||
token.value = token.value.strip("'\"")
|
||||
|
||||
for candidate in (PLACE.GET, PLACE.POST):
|
||||
for candidate in (PLACE.GET, PLACE.POST, PLACE.CUSTOM_POST, PLACE.URI):
|
||||
if candidate in conf.parameters:
|
||||
if candidate == PLACE.GET and get:
|
||||
if candidate == PLACE.URI and uri:
|
||||
uri = _adjustParameter(uri, token.name, token.value)
|
||||
elif candidate == PLACE.GET and get:
|
||||
get = _adjustParameter(get, token.name, token.value)
|
||||
elif candidate == PLACE.POST and post:
|
||||
elif candidate in (PLACE.POST, PLACE.CUSTOM_POST) and post:
|
||||
post = _adjustParameter(post, token.name, token.value)
|
||||
|
||||
for i in xrange(len(conf.httpHeaders)):
|
||||
|
||||
@@ -11,6 +11,8 @@ import socket
|
||||
|
||||
from lib.core.common import filterNone
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.compat import xrange
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.exception import SqlmapConnectionException
|
||||
@@ -43,6 +45,8 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
||||
_contexts[None] = ssl._create_default_https_context()
|
||||
kwargs["context"] = _contexts[None]
|
||||
|
||||
self.retrying = False
|
||||
|
||||
_http_client.HTTPSConnection.__init__(self, *args, **kwargs)
|
||||
|
||||
def connect(self):
|
||||
@@ -58,7 +62,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
||||
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
|
||||
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
|
||||
if re.search(r"\A[\d.]+\Z", self.host) is None and kb.tlsSNI.get(self.host) is not False and hasattr(ssl, "SSLContext"):
|
||||
for protocol in [_ for _ in _protocols if _ >= ssl.PROTOCOL_TLSv1]:
|
||||
for protocol in (_ for _ in _protocols if _ >= ssl.PROTOCOL_TLSv1):
|
||||
try:
|
||||
sock = create_sock()
|
||||
if protocol not in _contexts:
|
||||
@@ -101,7 +105,21 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
||||
# Reference: https://docs.python.org/2/library/ssl.html
|
||||
if distutils.version.LooseVersion(PYVERSION) < distutils.version.LooseVersion("2.7.9"):
|
||||
errMsg += " (please retry with Python >= 2.7.9)"
|
||||
|
||||
if kb.sslSuccess and not self.retrying:
|
||||
self.retrying = True
|
||||
|
||||
for _ in xrange(conf.retries):
|
||||
try:
|
||||
self.connect()
|
||||
except SqlmapConnectionException:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
else:
|
||||
kb.sslSuccess = True
|
||||
|
||||
class HTTPSHandler(_urllib.request.HTTPSHandler):
|
||||
def https_open(self, req):
|
||||
|
||||
@@ -153,7 +153,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
|
||||
result.info()
|
||||
except AttributeError:
|
||||
def _(self):
|
||||
return getattr(self, "hdrs") or {}
|
||||
return getattr(self, "hdrs", {})
|
||||
|
||||
result.info = types.MethodType(_, result)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ See the file 'LICENSE' for copying permission
|
||||
|
||||
import os
|
||||
|
||||
from lib.core.common import openFile
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
@@ -48,7 +49,7 @@ class Registry(object):
|
||||
)
|
||||
|
||||
def _createLocalBatchFile(self):
|
||||
self._batPathFp = open(self._batPathLocal, "w")
|
||||
self._batPathFp = openFile(self._batPathLocal, "w")
|
||||
|
||||
if self._operation == REGISTRY_OPERATION.READ:
|
||||
lines = self._batRead
|
||||
|
||||
+2
-1
@@ -61,6 +61,7 @@ from thirdparty.bottle.bottle import request
|
||||
from thirdparty.bottle.bottle import response
|
||||
from thirdparty.bottle.bottle import run
|
||||
from thirdparty.bottle.bottle import server_names
|
||||
from thirdparty import six
|
||||
from thirdparty.six.moves import http_client as _http_client
|
||||
from thirdparty.six.moves import input as _input
|
||||
from thirdparty.six.moves import urllib as _urllib
|
||||
@@ -717,7 +718,7 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
|
||||
errMsg += "List of supported adapters: %s" % ', '.join(sorted(list(server_names.keys())))
|
||||
else:
|
||||
errMsg = "Server support for adapter '%s' is not installed on this system " % adapter
|
||||
errMsg += "(Note: you can try to install it with 'sudo apt install python-%s' or 'sudo pip install %s')" % (adapter, adapter)
|
||||
errMsg += "(Note: you can try to install it with 'sudo apt install python-%s' or 'sudo pip%s install %s')" % (adapter, '3' if six.PY3 else "", adapter)
|
||||
logger.critical(errMsg)
|
||||
|
||||
def _client(url, options=None):
|
||||
|
||||
@@ -699,6 +699,10 @@ answers =
|
||||
# Parameter(s) containing Base64 encoded data
|
||||
base64Parameter =
|
||||
|
||||
# Use URL and filename safe Base64 alphabet (Reference: https://en.wikipedia.org/wiki/Base64#URL_applications).
|
||||
# Valid: True or False
|
||||
base64Safe = False
|
||||
|
||||
# Never ask for user input, use the default behaviour.
|
||||
# Valid: True or False
|
||||
batch = False
|
||||
|
||||
+4
-1
@@ -5,14 +5,17 @@ Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.HIGHEST
|
||||
|
||||
def dependencies():
|
||||
pass
|
||||
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s" % (os.path.basename(__file__).split(".")[0], DBMS.ORACLE))
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -5,17 +5,14 @@ Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.HIGHEST
|
||||
|
||||
def dependencies():
|
||||
singleTimeWarnMessage("tamper script '%s' is unlikely to work against %s" % (os.path.basename(__file__).split(".")[0], DBMS.PGSQL))
|
||||
pass
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.HIGHEST
|
||||
|
||||
def dependencies():
|
||||
pass
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
Replaces all occurrences of operator equal ('=') with 'RLIKE' counterpart
|
||||
|
||||
Tested against:
|
||||
* MySQL 4, 5.0 and 5.5
|
||||
|
||||
Notes:
|
||||
* Useful to bypass weak and bespoke web application firewalls that
|
||||
filter the equal character ('=')
|
||||
|
||||
>>> tamper('SELECT * FROM users WHERE id=1')
|
||||
'SELECT * FROM users WHERE id RLIKE 1'
|
||||
"""
|
||||
|
||||
retVal = payload
|
||||
|
||||
if payload:
|
||||
retVal = re.sub(r"\s*=\s*", " RLIKE ", retVal)
|
||||
|
||||
return retVal
|
||||
+3
-1
@@ -7,14 +7,16 @@ See the file 'LICENSE' for copying permission
|
||||
|
||||
import re
|
||||
|
||||
from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.convert import decodeHex
|
||||
from lib.core.convert import getOrds
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.NORMAL
|
||||
|
||||
def dependencies():
|
||||
pass
|
||||
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s" % (os.path.basename(__file__).split(".")[0], DBMS.MYSQL))
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
|
||||
+4
-1
@@ -5,14 +5,17 @@ Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from lib.core.common import singleTimeWarnMessage
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PRIORITY
|
||||
|
||||
__priority__ = PRIORITY.HIGHEST
|
||||
|
||||
def dependencies():
|
||||
pass
|
||||
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s" % (os.path.basename(__file__).split(".")[0], DBMS.MYSQL))
|
||||
|
||||
def tamper(payload, **kwargs):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user