Minor patch

This commit is contained in:
Miroslav Stampar 2019-05-03 13:48:41 +02:00
parent e90e800dde
commit 74148e121a
4 changed files with 12 additions and 8 deletions

View File

@ -922,7 +922,7 @@ def setColor(message, color=None, bold=False, level=None, istty=None):
elif level: elif level:
try: try:
level = getattr(logging, level, None) level = getattr(logging, level, None)
except UnicodeError: except:
level = None level = None
retVal = LOGGER_HANDLER.colorize(message, level) retVal = LOGGER_HANDLER.colorize(message, level)

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty import six from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.5.12" VERSION = "1.3.5.13"
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)

View File

@ -25,6 +25,7 @@ from lib.core.common import ntToPosixSlashes
from lib.core.common import isTechniqueAvailable from lib.core.common import isTechniqueAvailable
from lib.core.common import isWindowsDriveLetterPath from lib.core.common import isWindowsDriveLetterPath
from lib.core.common import normalizePath from lib.core.common import normalizePath
from lib.core.common import openFile
from lib.core.common import parseFilePaths from lib.core.common import parseFilePaths
from lib.core.common import posixToNtSlashes from lib.core.common import posixToNtSlashes
from lib.core.common import randomInt from lib.core.common import randomInt
@ -34,6 +35,7 @@ from lib.core.common import singleTimeWarnMessage
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.convert import encodeHex from lib.core.convert import encodeHex
from lib.core.convert import getBytes from lib.core.convert import getBytes
from lib.core.convert import getText
from lib.core.data import conf 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
@ -274,9 +276,9 @@ class Web:
directories = _ directories = _
backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webPlatform) backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webPlatform)
backdoorContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.%s_" % self.webPlatform)) backdoorContent = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.%s_" % self.webPlatform)))
stagerContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)) stagerContent = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)))
for directory in directories: for directory in directories:
if not directory: if not directory:
@ -330,9 +332,9 @@ class Web:
handle, filename = tempfile.mkstemp() handle, filename = tempfile.mkstemp()
os.close(handle) os.close(handle)
with open(filename, "w+b") as f: with openFile(filename, "w+b") as f:
_ = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)) _ = getText(decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webPlatform)))
_ = _.replace(SHELL_WRITABLE_DIR_TAG, getBytes(directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory)) _ = _.replace(SHELL_WRITABLE_DIR_TAG, directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory)
f.write(_) f.write(_)
self.unionWriteFile(filename, self.webStagerFilePath, "text", forceCheck=True) self.unionWriteFile(filename, self.webStagerFilePath, "text", forceCheck=True)

View File

@ -5,6 +5,7 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import codecs
import os import os
import sys import sys
@ -21,6 +22,7 @@ from lib.core.common import isStackingAvailable
from lib.core.common import isTechniqueAvailable from lib.core.common import isTechniqueAvailable
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.convert import getText
from lib.core.data import conf 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
@ -133,7 +135,7 @@ class Filesystem:
retVal = [] retVal = []
if encoding: if encoding:
content = content.encode(encoding).replace("\n", "") content = getText(codecs.encode(content, encoding)).replace("\n", "")
if not single: if not single:
if len(content) > chunkSize: if len(content) > chunkSize: