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

Skip to content

Commit 1a0c533

Browse files
committed
Fixes #4541
1 parent 5d3bd6e commit 1a0c533

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

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.5.1.27"
21+
VERSION = "1.5.1.28"
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/takeover/xp_cmdshell.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ def xpCmdshellForgeCmd(self, cmd, insertIntoTable=None):
166166
# Obfuscate the command to execute, also useful to bypass filters
167167
# on single-quotes
168168
self._randStr = randomStr(lowercase=True)
169-
self._cmd = "0x%s" % encodeHex(cmd, binary=False)
170169
self._forgedCmd = "DECLARE @%s VARCHAR(8000);" % self._randStr
171-
self._forgedCmd += "SET @%s=%s;" % (self._randStr, self._cmd)
170+
171+
try:
172+
self._forgedCmd += "SET @%s=%s;" % (self._randStr, "0x%s" % encodeHex(cmd, binary=False))
173+
except UnicodeError:
174+
self._forgedCmd += "SET @%s='%s';" % (self._randStr, cmd)
172175

173176
# Insert the command standard output into a support table,
174177
# 'sqlmapoutput', except when DBMS credentials are provided because

0 commit comments

Comments
 (0)