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:
|
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:
|
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к
|
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å«]'§ºÃÇ
|
||||||
У╟╢?Ч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
|
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="CLI Driver.*?DB2"/>
|
||||||
<error regexp="DB2 SQL error"/>
|
<error regexp="DB2 SQL error"/>
|
||||||
<error regexp="\bdb2_\w+\("/>
|
<error regexp="\bdb2_\w+\("/>
|
||||||
<error regexp="SQLSTATE.+SQLCODE"/>
|
<error regexp="SQLCODE[=:\d, -]+SQLSTATE"/>
|
||||||
<error regexp="com\.ibm\.db2\.jcc"/>
|
<error regexp="com\.ibm\.db2\.jcc"/>
|
||||||
<error regexp="Zend_Db_(Adapter|Statement)_Db2_Exception"/>
|
<error regexp="Zend_Db_(Adapter|Statement)_Db2_Exception"/>
|
||||||
<error regexp="Pdo[./_\\]Ibm"/>
|
<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
|
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).
|
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
|
Liens
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 0):
|
|||||||
xrange = range
|
xrange = range
|
||||||
ord = lambda _: _
|
ord = lambda _: _
|
||||||
|
|
||||||
KEY = b"Beeth7hoyooleeF0"
|
KEY = b"MOZFqVjlk1CY436G"
|
||||||
|
|
||||||
def xor(message, key):
|
def xor(message, key):
|
||||||
return b"".join(struct.pack('B', ord(message[i]) ^ ord(key[i % len(key)])) for i in range(len(message)))
|
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.originalPage = kb.pageTemplate = threadData.lastPage
|
||||||
kb.originalCode = threadData.lastCode
|
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)
|
candidate = DEFAULT_COOKIE_DELIMITER.join("%s=%s" % (_.name, _.value) for _ in conf.cj)
|
||||||
|
|
||||||
message = "you have not declared cookie(s), while "
|
message = "you have not declared cookie(s), while "
|
||||||
|
|||||||
+6
-2
@@ -183,8 +183,12 @@ class Agent(object):
|
|||||||
newValue = self.adjustLateValues(newValue)
|
newValue = self.adjustLateValues(newValue)
|
||||||
|
|
||||||
# TODO: support for POST_HINT
|
# TODO: support for POST_HINT
|
||||||
newValue = encodeBase64(newValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
newValue = encodeBase64(newValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING, safe=conf.base64Safe)
|
||||||
origValue = encodeBase64(origValue, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
|
||||||
|
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):
|
if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER):
|
||||||
_ = "%s%s" % (origValue, kb.customInjectionMark)
|
_ = "%s%s" % (origValue, kb.customInjectionMark)
|
||||||
|
|||||||
+64
-4
@@ -631,7 +631,7 @@ def paramToDict(place, parameters=None):
|
|||||||
|
|
||||||
if parameter in (conf.base64Parameter or []):
|
if parameter in (conf.base64Parameter or []):
|
||||||
try:
|
try:
|
||||||
oldValue = value
|
kb.base64Originals[parameter] = oldValue = value
|
||||||
value = decodeBase64(value, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
value = decodeBase64(value, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
|
||||||
parameters = re.sub(r"\b%s(\b|\Z)" % re.escape(oldValue), value, parameters)
|
parameters = re.sub(r"\b%s(\b|\Z)" % re.escape(oldValue), value, parameters)
|
||||||
except:
|
except:
|
||||||
@@ -1051,6 +1051,16 @@ def dataToDumpFile(dumpFile, data):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def dataToOutFile(filename, data):
|
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
|
retVal = None
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
@@ -1348,7 +1358,7 @@ def banner():
|
|||||||
if not any(_ in sys.argv for _ in ("--version", "--api")) and not conf.get("disableBanner"):
|
if not any(_ in sys.argv for _ in ("--version", "--api")) and not conf.get("disableBanner"):
|
||||||
result = BANNER
|
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)
|
result = clearColors(result)
|
||||||
elif IS_WIN:
|
elif IS_WIN:
|
||||||
coloramainit()
|
coloramainit()
|
||||||
@@ -1714,6 +1724,11 @@ def escapeJsonValue(value):
|
|||||||
Escapes JSON value (used in payloads)
|
Escapes JSON value (used in payloads)
|
||||||
|
|
||||||
# Reference: https://stackoverflow.com/a/16652683
|
# Reference: https://stackoverflow.com/a/16652683
|
||||||
|
|
||||||
|
>>> "\\n" in escapeJsonValue("foo\\nbar")
|
||||||
|
False
|
||||||
|
>>> "\\\\t" in escapeJsonValue("foo\\tbar")
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = ""
|
retVal = ""
|
||||||
@@ -1888,6 +1903,12 @@ def getLocalIP():
|
|||||||
def getRemoteIP():
|
def getRemoteIP():
|
||||||
"""
|
"""
|
||||||
Get remote/target IP address
|
Get remote/target IP address
|
||||||
|
|
||||||
|
>>> pushValue(conf.hostname)
|
||||||
|
>>> conf.hostname = "localhost"
|
||||||
|
>>> getRemoteIP() == "127.0.0.1"
|
||||||
|
True
|
||||||
|
>>> conf.hostname = popValue()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
@@ -2014,6 +2035,9 @@ def normalizePath(filepath):
|
|||||||
def safeFilepathEncode(filepath):
|
def safeFilepathEncode(filepath):
|
||||||
"""
|
"""
|
||||||
Returns filepath in (ASCII) format acceptable for OS handling (e.g. reading)
|
Returns filepath in (ASCII) format acceptable for OS handling (e.g. reading)
|
||||||
|
|
||||||
|
>>> 'sqlmap' in safeFilepathEncode(paths.SQLMAP_HOME_PATH)
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = filepath
|
retVal = filepath
|
||||||
@@ -2220,6 +2244,15 @@ def isHexEncodedString(subject):
|
|||||||
def isMultiThreadMode():
|
def isMultiThreadMode():
|
||||||
"""
|
"""
|
||||||
Checks if running in multi-thread(ing) mode
|
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
|
return threading.activeCount() > 1
|
||||||
@@ -2228,6 +2261,9 @@ def isMultiThreadMode():
|
|||||||
def getConsoleWidth(default=80):
|
def getConsoleWidth(default=80):
|
||||||
"""
|
"""
|
||||||
Returns console width
|
Returns console width
|
||||||
|
|
||||||
|
>>> any((getConsoleWidth(), True))
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
width = None
|
width = None
|
||||||
@@ -2434,6 +2470,9 @@ def initCommonOutputs():
|
|||||||
def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, unique=False):
|
def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, unique=False):
|
||||||
"""
|
"""
|
||||||
Returns newline delimited items contained inside file
|
Returns newline delimited items contained inside file
|
||||||
|
|
||||||
|
>>> "SELECT" in getFileItems(paths.SQL_KEYWORDS)
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = list() if not unique else OrderedDict()
|
retVal = list() if not unique else OrderedDict()
|
||||||
@@ -2540,8 +2579,8 @@ def goGoodSamaritan(prevValue, originalCharset):
|
|||||||
|
|
||||||
def getPartRun(alias=True):
|
def getPartRun(alias=True):
|
||||||
"""
|
"""
|
||||||
Goes through call stack and finds constructs matching conf.dbmsHandler.*.
|
Goes through call stack and finds constructs matching
|
||||||
Returns it or its alias used in 'txt/common-outputs.txt'
|
conf.dbmsHandler.*. Returns it or its alias used in 'txt/common-outputs.txt'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
@@ -4964,6 +5003,14 @@ def decloakToTemp(filename):
|
|||||||
>>> openFile(_, "rb", encoding=None).read().startswith(b'<%')
|
>>> openFile(_, "rb", encoding=None).read().startswith(b'<%')
|
||||||
True
|
True
|
||||||
>>> os.remove(_)
|
>>> 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)
|
content = decloak(filename)
|
||||||
@@ -4997,6 +5044,12 @@ def getRequestHeader(request, name):
|
|||||||
Solving an issue with an urllib2 Request header case sensitivity
|
Solving an issue with an urllib2 Request header case sensitivity
|
||||||
|
|
||||||
# Reference: http://bugs.python.org/issue2275
|
# Reference: http://bugs.python.org/issue2275
|
||||||
|
|
||||||
|
>>> _ = lambda _: _
|
||||||
|
>>> _.headers = {"FOO": "BAR"}
|
||||||
|
>>> _.header_items = lambda: _.headers.items()
|
||||||
|
>>> getText(getRequestHeader(_, "foo"))
|
||||||
|
'BAR'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
@@ -5094,6 +5147,13 @@ def pollProcess(process, suppress_errors=False):
|
|||||||
def parseRequestFile(reqFile, checkParams=True):
|
def parseRequestFile(reqFile, checkParams=True):
|
||||||
"""
|
"""
|
||||||
Parses WebScarab and Burp logs and adds results to the target URL list
|
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):
|
def _parseWebScarabLog(content):
|
||||||
|
|||||||
+35
-3
@@ -198,6 +198,8 @@ def decodeBase64(value, binary=True, encoding=None):
|
|||||||
True
|
True
|
||||||
>>> decodeBase64("MTIz", binary=False)
|
>>> decodeBase64("MTIz", binary=False)
|
||||||
'123'
|
'123'
|
||||||
|
>>> decodeBase64("A-B_CDE") == decodeBase64("A+B/CDE")
|
||||||
|
True
|
||||||
>>> decodeBase64(b"MTIzNA") == b"1234"
|
>>> decodeBase64(b"MTIzNA") == b"1234"
|
||||||
True
|
True
|
||||||
>>> decodeBase64("MTIzNA") == b"1234"
|
>>> decodeBase64("MTIzNA") == b"1234"
|
||||||
@@ -206,12 +208,22 @@ def decodeBase64(value, binary=True, encoding=None):
|
|||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
|
||||||
padding = b'=' if isinstance(value, bytes) else '='
|
padding = b'=' if isinstance(value, bytes) else '='
|
||||||
|
|
||||||
# Reference: https://stackoverflow.com/a/49459036
|
# Reference: https://stackoverflow.com/a/49459036
|
||||||
if not value.endswith(padding):
|
if not value.endswith(padding):
|
||||||
value += 3 * 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)
|
retVal = base64.b64decode(value)
|
||||||
|
|
||||||
if not binary:
|
if not binary:
|
||||||
@@ -219,16 +231,23 @@ def decodeBase64(value, binary=True, encoding=None):
|
|||||||
|
|
||||||
return retVal
|
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
|
Returns a decoded representation of provided Base64 value
|
||||||
|
|
||||||
>>> encodeBase64(b"123") == b"MTIz"
|
>>> encodeBase64(b"123") == b"MTIz"
|
||||||
True
|
True
|
||||||
>>> encodeBase64(u"123", binary=False)
|
>>> encodeBase64(u"1234", binary=False)
|
||||||
'MTIz'
|
'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):
|
if isinstance(value, six.text_type):
|
||||||
value = value.encode(encoding or UNICODE_ENCODING)
|
value = value.encode(encoding or UNICODE_ENCODING)
|
||||||
|
|
||||||
@@ -237,6 +256,19 @@ def encodeBase64(value, binary=True, encoding=None):
|
|||||||
if not binary:
|
if not binary:
|
||||||
retVal = getText(retVal, encoding)
|
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
|
return retVal
|
||||||
|
|
||||||
def getBytes(value, encoding=None, errors="strict", unsafe=True):
|
def getBytes(value, encoding=None, errors="strict", unsafe=True):
|
||||||
|
|||||||
+4
-2
@@ -1856,6 +1856,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
|||||||
kb.arch = None
|
kb.arch = None
|
||||||
kb.authHeader = None
|
kb.authHeader = None
|
||||||
kb.bannerFp = AttribDict()
|
kb.bannerFp = AttribDict()
|
||||||
|
kb.base64Originals = {}
|
||||||
kb.binaryField = False
|
kb.binaryField = False
|
||||||
kb.browserVerification = None
|
kb.browserVerification = None
|
||||||
|
|
||||||
@@ -2008,10 +2009,11 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
|||||||
kb.skipSeqMatcher = False
|
kb.skipSeqMatcher = False
|
||||||
kb.smokeMode = False
|
kb.smokeMode = False
|
||||||
kb.reduceTests = None
|
kb.reduceTests = None
|
||||||
kb.tlsSNI = {}
|
kb.sslSuccess = False
|
||||||
kb.stickyDBMS = False
|
kb.stickyDBMS = False
|
||||||
kb.storeHashesChoice = None
|
kb.storeHashesChoice = None
|
||||||
kb.suppressResumeInfo = False
|
kb.suppressResumeInfo = False
|
||||||
|
kb.tableExistsChoice = None
|
||||||
kb.tableFrom = None
|
kb.tableFrom = None
|
||||||
kb.technique = None
|
kb.technique = None
|
||||||
kb.tempDir = None
|
kb.tempDir = None
|
||||||
@@ -2021,7 +2023,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
|||||||
kb.testType = None
|
kb.testType = None
|
||||||
kb.threadContinue = True
|
kb.threadContinue = True
|
||||||
kb.threadException = False
|
kb.threadException = False
|
||||||
kb.tableExistsChoice = None
|
kb.tlsSNI = {}
|
||||||
kb.uChar = NULL
|
kb.uChar = NULL
|
||||||
kb.udfFail = False
|
kb.udfFail = False
|
||||||
kb.unionDuplicates = False
|
kb.unionDuplicates = False
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ optDict = {
|
|||||||
"answers": "string",
|
"answers": "string",
|
||||||
"batch": "boolean",
|
"batch": "boolean",
|
||||||
"base64Parameter": "string",
|
"base64Parameter": "string",
|
||||||
|
"base64Safe": "boolean",
|
||||||
"binaryFields": "string",
|
"binaryFields": "string",
|
||||||
"charset": "string",
|
"charset": "string",
|
||||||
"checkInternet": "boolean",
|
"checkInternet": "boolean",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import lib.controller.checks
|
import lib.controller.checks
|
||||||
@@ -76,6 +77,15 @@ def dirtyPatches():
|
|||||||
# to prevent too much "guessing" in case of binary data retrieval
|
# to prevent too much "guessing" in case of binary data retrieval
|
||||||
thirdparty.chardet.universaldetector.MINIMUM_THRESHOLD = 0.90
|
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():
|
def resolveCrossReferences():
|
||||||
"""
|
"""
|
||||||
Place for cross-reference resolution
|
Place for cross-reference resolution
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from lib.core.enums import OS
|
|||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# 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 = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
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):
|
def process(match, repl):
|
||||||
retVal = match.group(0)
|
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
|
retVal = repl
|
||||||
while True:
|
while True:
|
||||||
_ = re.search(r"\\g<([^>]+)>", retVal)
|
_ = re.search(r"\\g<([^>]+)>", retVal)
|
||||||
@@ -400,7 +400,7 @@ def _setRequestParams():
|
|||||||
raise SqlmapGenericException(errMsg)
|
raise SqlmapGenericException(errMsg)
|
||||||
|
|
||||||
if conf.csrfToken:
|
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 = "anti-CSRF token parameter '%s' not " % conf.csrfToken._original
|
||||||
errMsg += "found in provided GET, POST, Cookie or header values"
|
errMsg += "found in provided GET, POST, Cookie or header values"
|
||||||
raise SqlmapGenericException(errMsg)
|
raise SqlmapGenericException(errMsg)
|
||||||
|
|||||||
+18
-7
@@ -622,6 +622,9 @@ def cmdLineParser(argv=None):
|
|||||||
general.add_argument("--base64", dest="base64Parameter",
|
general.add_argument("--base64", dest="base64Parameter",
|
||||||
help="Parameter(s) containing Base64 encoded data")
|
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",
|
general.add_argument("--batch", dest="batch", action="store_true",
|
||||||
help="Never ask for user input, use the default behavior")
|
help="Never ask for user input, use the default behavior")
|
||||||
|
|
||||||
@@ -860,7 +863,7 @@ def cmdLineParser(argv=None):
|
|||||||
_ = []
|
_ = []
|
||||||
advancedHelp = True
|
advancedHelp = True
|
||||||
extraHeaders = []
|
extraHeaders = []
|
||||||
tamperIndex = None
|
auxIndexes = {}
|
||||||
|
|
||||||
# Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
|
# Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
|
||||||
for arg in argv:
|
for arg in argv:
|
||||||
@@ -949,17 +952,25 @@ def cmdLineParser(argv=None):
|
|||||||
argv[i] = ""
|
argv[i] = ""
|
||||||
elif argv[i] in DEPRECATED_OPTIONS:
|
elif argv[i] in DEPRECATED_OPTIONS:
|
||||||
argv[i] = ""
|
argv[i] = ""
|
||||||
elif argv[i].startswith("--tamper"):
|
elif any(argv[i].startswith(_) for _ in ("--tamper",)):
|
||||||
if tamperIndex is None:
|
key = re.search(r"\-\-(\w+)", argv[i]).group(1)
|
||||||
tamperIndex = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None)
|
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:
|
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] = ""
|
argv[i] = ""
|
||||||
elif argv[i] in ("-H", "--header"):
|
elif argv[i] in ("-H", "--header") or any(argv[i].startswith("%s=" % _) for _ in ("-H", "--header")):
|
||||||
if i + 1 < len(argv):
|
if '=' in argv[i]:
|
||||||
|
extraHeaders.append(argv[i].split('=', 1)[1])
|
||||||
|
elif i + 1 < len(argv):
|
||||||
extraHeaders.append(argv[i + 1])
|
extraHeaders.append(argv[i + 1])
|
||||||
elif argv[i] == "--deps":
|
elif argv[i] == "--deps":
|
||||||
argv[i] = "--dependencies"
|
argv[i] = "--dependencies"
|
||||||
|
elif argv[i] == "--disable-colouring":
|
||||||
|
argv[i] = "--disable-coloring"
|
||||||
elif argv[i] == "-r":
|
elif argv[i] == "-r":
|
||||||
for j in xrange(i + 2, len(argv)):
|
for j in xrange(i + 2, len(argv)):
|
||||||
value = argv[j]
|
value = argv[j]
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ def processResponse(page, responseHeaders, code=None, status=None):
|
|||||||
if msg:
|
if msg:
|
||||||
logger.warning("parsed DBMS error message: '%s'" % msg.rstrip('.'))
|
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)
|
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()
|
identYwaf.non_blind.clear()
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ class Connect(object):
|
|||||||
conn = _urllib.request.urlopen(req)
|
conn = _urllib.request.urlopen(req)
|
||||||
|
|
||||||
if not kb.authHeader and getRequestHeader(req, HTTP_HEADER.AUTHORIZATION) and (conf.authType or "").lower() == AUTH_TYPE.BASIC.lower():
|
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):
|
if not kb.proxyAuthHeader and getRequestHeader(req, HTTP_HEADER.PROXY_AUTHORIZATION):
|
||||||
kb.proxyAuthHeader = getRequestHeader(req, HTTP_HEADER.PROXY_AUTHORIZATION)
|
kb.proxyAuthHeader = getRequestHeader(req, HTTP_HEADER.PROXY_AUTHORIZATION)
|
||||||
@@ -1125,11 +1125,13 @@ class Connect(object):
|
|||||||
if token:
|
if token:
|
||||||
token.value = token.value.strip("'\"")
|
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 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)
|
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)
|
post = _adjustParameter(post, token.name, token.value)
|
||||||
|
|
||||||
for i in xrange(len(conf.httpHeaders)):
|
for i in xrange(len(conf.httpHeaders)):
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import socket
|
|||||||
|
|
||||||
from lib.core.common import filterNone
|
from lib.core.common import filterNone
|
||||||
from lib.core.common import getSafeExString
|
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 kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.exception import SqlmapConnectionException
|
from lib.core.exception import SqlmapConnectionException
|
||||||
@@ -43,6 +45,8 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
|||||||
_contexts[None] = ssl._create_default_https_context()
|
_contexts[None] = ssl._create_default_https_context()
|
||||||
kwargs["context"] = _contexts[None]
|
kwargs["context"] = _contexts[None]
|
||||||
|
|
||||||
|
self.retrying = False
|
||||||
|
|
||||||
_http_client.HTTPSConnection.__init__(self, *args, **kwargs)
|
_http_client.HTTPSConnection.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
@@ -58,7 +62,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
|||||||
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
|
# 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
|
# 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"):
|
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:
|
try:
|
||||||
sock = create_sock()
|
sock = create_sock()
|
||||||
if protocol not in _contexts:
|
if protocol not in _contexts:
|
||||||
@@ -101,7 +105,21 @@ class HTTPSConnection(_http_client.HTTPSConnection):
|
|||||||
# Reference: https://docs.python.org/2/library/ssl.html
|
# Reference: https://docs.python.org/2/library/ssl.html
|
||||||
if distutils.version.LooseVersion(PYVERSION) < distutils.version.LooseVersion("2.7.9"):
|
if distutils.version.LooseVersion(PYVERSION) < distutils.version.LooseVersion("2.7.9"):
|
||||||
errMsg += " (please retry with Python >= 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)
|
raise SqlmapConnectionException(errMsg)
|
||||||
|
else:
|
||||||
|
kb.sslSuccess = True
|
||||||
|
|
||||||
class HTTPSHandler(_urllib.request.HTTPSHandler):
|
class HTTPSHandler(_urllib.request.HTTPSHandler):
|
||||||
def https_open(self, req):
|
def https_open(self, req):
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
|
|||||||
result.info()
|
result.info()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
def _(self):
|
def _(self):
|
||||||
return getattr(self, "hdrs") or {}
|
return getattr(self, "hdrs", {})
|
||||||
|
|
||||||
result.info = types.MethodType(_, result)
|
result.info = types.MethodType(_, result)
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ See the file 'LICENSE' for copying permission
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from lib.core.common import openFile
|
||||||
from lib.core.common import randomStr
|
from lib.core.common import randomStr
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
@@ -48,7 +49,7 @@ class Registry(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _createLocalBatchFile(self):
|
def _createLocalBatchFile(self):
|
||||||
self._batPathFp = open(self._batPathLocal, "w")
|
self._batPathFp = openFile(self._batPathLocal, "w")
|
||||||
|
|
||||||
if self._operation == REGISTRY_OPERATION.READ:
|
if self._operation == REGISTRY_OPERATION.READ:
|
||||||
lines = self._batRead
|
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 response
|
||||||
from thirdparty.bottle.bottle import run
|
from thirdparty.bottle.bottle import run
|
||||||
from thirdparty.bottle.bottle import server_names
|
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 http_client as _http_client
|
||||||
from thirdparty.six.moves import input as _input
|
from thirdparty.six.moves import input as _input
|
||||||
from thirdparty.six.moves import urllib as _urllib
|
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())))
|
errMsg += "List of supported adapters: %s" % ', '.join(sorted(list(server_names.keys())))
|
||||||
else:
|
else:
|
||||||
errMsg = "Server support for adapter '%s' is not installed on this system " % adapter
|
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)
|
logger.critical(errMsg)
|
||||||
|
|
||||||
def _client(url, options=None):
|
def _client(url, options=None):
|
||||||
|
|||||||
@@ -699,6 +699,10 @@ answers =
|
|||||||
# Parameter(s) containing Base64 encoded data
|
# Parameter(s) containing Base64 encoded data
|
||||||
base64Parameter =
|
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.
|
# Never ask for user input, use the default behaviour.
|
||||||
# Valid: True or False
|
# Valid: True or False
|
||||||
batch = 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
|
See the file 'LICENSE' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from lib.core.common import singleTimeWarnMessage
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
|
|
||||||
__priority__ = PRIORITY.HIGHEST
|
__priority__ = PRIORITY.HIGHEST
|
||||||
|
|
||||||
def dependencies():
|
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):
|
def tamper(payload, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -5,17 +5,14 @@ Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
|
|||||||
See the file 'LICENSE' for copying permission
|
See the file 'LICENSE' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from lib.core.common import singleTimeWarnMessage
|
|
||||||
from lib.core.enums import DBMS
|
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
|
|
||||||
__priority__ = PRIORITY.HIGHEST
|
__priority__ = PRIORITY.HIGHEST
|
||||||
|
|
||||||
def dependencies():
|
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):
|
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
|
import re
|
||||||
|
|
||||||
|
from lib.core.common import singleTimeWarnMessage
|
||||||
from lib.core.convert import decodeHex
|
from lib.core.convert import decodeHex
|
||||||
from lib.core.convert import getOrds
|
from lib.core.convert import getOrds
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
|
|
||||||
__priority__ = PRIORITY.NORMAL
|
__priority__ = PRIORITY.NORMAL
|
||||||
|
|
||||||
def dependencies():
|
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):
|
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
|
See the file 'LICENSE' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from lib.core.common import singleTimeWarnMessage
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
|
|
||||||
__priority__ = PRIORITY.HIGHEST
|
__priority__ = PRIORITY.HIGHEST
|
||||||
|
|
||||||
def dependencies():
|
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):
|
def tamper(payload, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user