Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7f20c1

Browse files
committed
Minor update (base64 stuff)
1 parent f781367 commit a7f20c1

5 files changed

Lines changed: 13 additions & 4 deletions

File tree

extra/vulnserver/vulnserver.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from __future__ import print_function
1111

12+
import base64
1213
import json
1314
import re
1415
import sqlite3
@@ -146,7 +147,10 @@ def do_REQUEST(self):
146147
if "query" in self.params:
147148
_cursor.execute(self.params["query"])
148149
elif "id" in self.params:
149-
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % self.params["id"])
150+
if "base64" in self.params:
151+
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % base64.b64decode("%s===" % self.params["id"], altchars=self.params.get("altchars")).decode())
152+
else:
153+
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % self.params["id"])
150154
results = _cursor.fetchall()
151155

152156
output += "<b>SQL results:</b><br>\n"

lib/core/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ def paramToDict(place, parameters=None):
632632
if parameter in (conf.base64Parameter or []):
633633
try:
634634
kb.base64Originals[parameter] = oldValue = value
635+
value = urldecode(value, convall=True)
635636
value = decodeBase64(value, binary=False, encoding=conf.encoding or UNICODE_ENCODING)
636637
parameters = re.sub(r"\b%s(\b|\Z)" % re.escape(oldValue), value, parameters)
637638
except:

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.9.1"
21+
VERSION = "1.4.9.2"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/testing.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def vulnTest():
3939

4040
TESTS = (
4141
("-h", ("to see full list of options run with '-hh'",)),
42+
("-u <base64> -p id --base64=id -v 6 --data='base64=true' --flush-session --banner --technique=BEU", ("banner: '3.",)),
4243
("--dependencies", ("sqlmap requires", "third-party library")),
4344
("-u <url> --flush-session --wizard", ("Please choose:", "back-end DBMS: SQLite", "current user is DBA: True", "banner: '3.")),
4445
(u"-c <config> --flush-session --roles --statements --hostname --privileges --sql-query=\"SELECT '\u0161u\u0107uraj'\" --technique=U", (u": '\u0161u\u0107uraj'", "on SQLite it is not possible")),
@@ -125,7 +126,10 @@ def _thread():
125126
status = '%d/%d (%d%%) ' % (count, len(TESTS), round(100.0 * count / len(TESTS)))
126127
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
127128

128-
cmd = "%s %s %s --batch --non-interactive" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options.replace("<url>", url).replace("<direct>", direct).replace("<request>", request).replace("<log>", log).replace("<config>", config))
129+
for tag, value in (("<url>", url), ("<direct>", direct), ("<request>", request), ("<log>", log), ("<config>", config), ("<base64>", url.replace("id=1", "id=MZ=%3d"))):
130+
options = options.replace(tag, value)
131+
132+
cmd = "%s %s %s --batch --non-interactive" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options)
129133

130134
if "<tmp>" in cmd:
131135
handle, tmp = tempfile.mkstemp()

lib/parse/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def cmdLineParser(argv=None):
623623
help="Parameter(s) containing Base64 encoded data")
624624

625625
general.add_argument("--base64-safe", dest="base64Safe", action="store_true",
626-
help="Use URL and filename safe Base64 alphabet")
626+
help="Use URL and filename safe Base64 alphabet (RFC 4648)")
627627

628628
general.add_argument("--batch", dest="batch", action="store_true",
629629
help="Never ask for user input, use the default behavior")

0 commit comments

Comments
 (0)