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

Skip to content

Commit 74148e1

Browse files
committed
Minor patch
1 parent e90e800 commit 74148e1

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def setColor(message, color=None, bold=False, level=None, istty=None):
922922
elif level:
923923
try:
924924
level = getattr(logging, level, None)
925-
except UnicodeError:
925+
except:
926926
level = None
927927
retVal = LOGGER_HANDLER.colorize(message, level)
928928

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 import six
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.12"
21+
VERSION = "1.3.5.13"
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/web.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from lib.core.common import isTechniqueAvailable
2626
from lib.core.common import isWindowsDriveLetterPath
2727
from lib.core.common import normalizePath
28+
from lib.core.common import openFile
2829
from lib.core.common import parseFilePaths
2930
from lib.core.common import posixToNtSlashes
3031
from lib.core.common import randomInt
@@ -34,6 +35,7 @@
3435
from lib.core.compat import xrange
3536
from lib.core.convert import encodeHex
3637
from lib.core.convert import getBytes
38+
from lib.core.convert import getText
3739
from lib.core.data import conf
3840
from lib.core.data import kb
3941
from lib.core.data import logger
@@ -274,9 +276,9 @@ def webInit(self):
274276
directories = _
275277

276278
backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webPlatform)
277-
backdoorContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.%s_" % self.webPlatform))
279+
backdoorContent = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.%s_" % self.webPlatform)))
278280

279-
stagerContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform))
281+
stagerContent = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)))
280282

281283
for directory in directories:
282284
if not directory:
@@ -330,9 +332,9 @@ def webInit(self):
330332
handle, filename = tempfile.mkstemp()
331333
os.close(handle)
332334

333-
with open(filename, "w+b") as f:
334-
_ = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform))
335-
_ = _.replace(SHELL_WRITABLE_DIR_TAG, getBytes(directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory))
335+
with openFile(filename, "w+b") as f:
336+
_ = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)))
337+
_ = _.replace(SHELL_WRITABLE_DIR_TAG, directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory)
336338
f.write(_)
337339

338340
self.unionWriteFile(filename, self.webStagerFilePath, "text", forceCheck=True)

plugins/generic/filesystem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
import codecs
89
import os
910
import sys
1011

@@ -21,6 +22,7 @@
2122
from lib.core.common import isTechniqueAvailable
2223
from lib.core.common import readInput
2324
from lib.core.compat import xrange
25+
from lib.core.convert import getText
2426
from lib.core.data import conf
2527
from lib.core.data import kb
2628
from lib.core.data import logger
@@ -133,7 +135,7 @@ def fileContentEncode(self, content, encoding, single, chunkSize=256):
133135
retVal = []
134136

135137
if encoding:
136-
content = content.encode(encoding).replace("\n", "")
138+
content = getText(codecs.encode(content, encoding)).replace("\n", "")
137139

138140
if not single:
139141
if len(content) > chunkSize:

0 commit comments

Comments
 (0)