Some more drei stuff

This commit is contained in:
Miroslav Stampar 2019-03-28 15:14:16 +01:00
parent 49586ad6dd
commit 4b020c4257
81 changed files with 125 additions and 167 deletions

View File

@ -16,6 +16,9 @@ import zlib
from optparse import OptionError from optparse import OptionError
from optparse import OptionParser from optparse import OptionParser
if sys.version_info.major > 2:
xrange = range
def hideAscii(data): def hideAscii(data):
retVal = "" retVal = ""
for i in xrange(len(data)): for i in xrange(len(data)):

View File

@ -18,6 +18,9 @@ import sys
from optparse import OptionError from optparse import OptionError
from optparse import OptionParser from optparse import OptionParser
if sys.version_info.major > 2:
xrange = range
# Regex used for recognition of hex encoded characters # Regex used for recognition of hex encoded characters
HEX_ENCODED_CHAR_REGEX = r"(?P<result>\\x[0-9A-Fa-f]{2})" HEX_ENCODED_CHAR_REGEX = r"(?P<result>\\x[0-9A-Fa-f]{2})"

View File

@ -9,7 +9,8 @@ from __future__ import print_function
import sys import sys
if len(sys.argv) > 0: if __name__ == "__main__":
if len(sys.argv) > 0:
items = list() items = list()
with open(sys.argv[1], 'r') as f: with open(sys.argv[1], 'r') as f:

View File

@ -1,8 +0,0 @@
#!/usr/bin/env python2
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
pass

View File

@ -1,134 +0,0 @@
#!/usr/bin/env python2
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import cookielib
import glob
import httplib
import inspect
import os
import re
import socket
import ssl
import subprocess
import sys
import urllib2
sys.dont_write_bytecode = True
if hasattr(ssl, "_create_unverified_context"):
ssl._create_default_https_context = ssl._create_unverified_context
NAME, VERSION, AUTHOR = "WAF Detectify", "0.1", "sqlmap developers (@sqlmap)"
TIMEOUT = 10
HEADERS = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "identity", "Cache-Control": "max-age=0"}
SQLMAP_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
SCRIPTS_DIR = os.path.join(SQLMAP_DIR, "waf")
LEVEL_COLORS = {"o": "\033[00;94m", "x": "\033[00;91m", "!": "\033[00;93m", "i": "\033[00;92m"}
CACHE = {}
WAF_FUNCTIONS = []
def get_page(get=None, url=None, host=None, data=None):
key = (get, url, host, data)
if key in CACHE:
return CACHE[key]
page, headers, code = None, {}, httplib.OK
url = url or ("%s%s%s" % (sys.argv[1], '?' if '?' not in sys.argv[1] else '&', get) if get else sys.argv[1])
if not url.startswith("http"):
url = "http://%s" % url
try:
req = urllib2.Request("".join(url[_].replace(' ', "%20") if _ > url.find('?') else url[_] for _ in xrange(len(url))), data, HEADERS)
conn = urllib2.urlopen(req, timeout=TIMEOUT)
page = conn.read()
headers = conn.info()
except Exception as ex:
code = getattr(ex, "code", None)
page = ex.read() if hasattr(ex, "read") else getattr(ex, "msg", "")
headers = ex.info() if hasattr(ex, "info") else {}
result = CACHE[key] = page, headers, code
return result
def colorize(message):
if not subprocess.mswindows and sys.stdout.isatty():
message = re.sub(r"\[(.)\]", lambda match: "[%s%s\033[00;49m]" % (LEVEL_COLORS[match.group(1)], match.group(1)), message)
message = message.replace("@sqlmap", "\033[00;96m@sqlmap\033[00;49m")
message = message.replace(NAME, "\033[00;93m%s\033[00;49m" % NAME)
return message
def main():
global WAF_FUNCTIONS
print(colorize("%s #v%s\n by: %s\n" % (NAME, VERSION, AUTHOR)))
if len(sys.argv) < 2:
sys.exit(colorize("[x] usage: python %s <hostname>" % os.path.split(__file__)[-1]))
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
sys.path.insert(0, SQLMAP_DIR)
for found in glob.glob(os.path.join(SCRIPTS_DIR, "*.py")):
dirname, filename = os.path.split(found)
dirname = os.path.abspath(dirname)
if filename == "__init__.py":
continue
if dirname not in sys.path:
sys.path.insert(0, dirname)
try:
if filename[:-3] in sys.modules:
del sys.modules[filename[:-3]]
module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or "utf8"))
except ImportError as ex:
sys.exit(colorize("[x] cannot import WAF script '%s' (%s)" % (filename[:-3], ex)))
_ = dict(inspect.getmembers(module))
if "detect" not in _:
sys.exit(colorize("[x] missing function 'detect(get_page)' in WAF script '%s'" % found))
else:
WAF_FUNCTIONS.append((_["detect"], _.get("__product__", filename[:-3])))
WAF_FUNCTIONS = sorted(WAF_FUNCTIONS, key=lambda _: "generic" in _[1].lower())
print(colorize("[i] checking '%s'..." % sys.argv[1]))
hostname = sys.argv[1].split("//")[-1].split('/')[0]
try:
socket.getaddrinfo(hostname, None)
except socket.gaierror:
print(colorize("[x] host '%s' does not exist" % hostname))
sys.exit(1)
found = False
for function, product in WAF_FUNCTIONS:
if found and "unknown" in product.lower():
continue
if function(get_page):
sys.exit(colorize("[!] WAF/IPS identified as '%s'" % product))
if not found:
print(colorize("[o] nothing found"))
print()
sys.exit(int(not found))
if __name__ == "__main__":
main()

View File

@ -105,6 +105,7 @@ from lib.request.inject import checkBooleanExpression
from lib.request.templates import getPageTemplate from lib.request.templates import getPageTemplate
from lib.techniques.union.test import unionTest from lib.techniques.union.test import unionTest
from lib.techniques.union.use import configUnion from lib.techniques.union.use import configUnion
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.six.moves import http_client as _http_client from thirdparty.six.moves import http_client as _http_client

View File

@ -72,6 +72,7 @@ from lib.core.settings import USER_AGENT_ALIASES
from lib.core.target import initTargetEnv from lib.core.target import initTargetEnv
from lib.core.target import setupTargetEnv from lib.core.target import setupTargetEnv
from lib.utils.hash import crackHashFile from lib.utils.hash import crackHashFile
from lib.utils.xrange import xrange
def _selectInjection(): def _selectInjection():
""" """

View File

@ -46,6 +46,7 @@ from lib.core.settings import REPLACEMENT_MARKER
from lib.core.settings import SINGLE_QUOTE_MARKER from lib.core.settings import SINGLE_QUOTE_MARKER
from lib.core.settings import SLEEP_TIME_MARKER from lib.core.settings import SLEEP_TIME_MARKER
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.utils.xrange import xrange
class Agent(object): class Agent(object):
""" """

View File

@ -20,6 +20,7 @@ from lib.core.enums import MKSTEMP_PREFIX
from lib.core.exception import SqlmapSystemException from lib.core.exception import SqlmapSystemException
from lib.core.settings import BIGARRAY_CHUNK_SIZE from lib.core.settings import BIGARRAY_CHUNK_SIZE
from lib.core.settings import BIGARRAY_COMPRESS_LEVEL from lib.core.settings import BIGARRAY_COMPRESS_LEVEL
from lib.utils.xrange import xrange
DEFAULT_SIZE_OF = sys.getsizeof(object()) DEFAULT_SIZE_OF = sys.getsizeof(object())

View File

@ -167,6 +167,7 @@ from lib.core.settings import VERSION_STRING
from lib.core.settings import WEBSCARAB_SPLITTER from lib.core.settings import WEBSCARAB_SPLITTER
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
from lib.utils.sqlalchemy import _sqlalchemy from lib.utils.sqlalchemy import _sqlalchemy
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.clientform.clientform import ParseResponse from thirdparty.clientform.clientform import ParseResponse
from thirdparty.clientform.clientform import ParseError from thirdparty.clientform.clientform import ParseError

View File

@ -50,6 +50,7 @@ from lib.core.settings import UNICODE_ENCODING
from lib.core.settings import UNSAFE_DUMP_FILEPATH_REPLACEMENT from lib.core.settings import UNSAFE_DUMP_FILEPATH_REPLACEMENT
from lib.core.settings import VERSION_STRING from lib.core.settings import VERSION_STRING
from lib.core.settings import WINDOWS_RESERVED_NAMES from lib.core.settings import WINDOWS_RESERVED_NAMES
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.magic import magic from thirdparty.magic import magic

View File

@ -147,6 +147,7 @@ from lib.utils.crawler import crawl
from lib.utils.deps import checkDependencies from lib.utils.deps import checkDependencies
from lib.utils.search import search from lib.utils.search import search
from lib.utils.purge import purge from lib.utils.purge import purge
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.keepalive import keepalive from thirdparty.keepalive import keepalive
from thirdparty.multipart import multipartpost from thirdparty.multipart import multipartpost

View File

@ -17,7 +17,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.3.70" VERSION = "1.3.3.71"
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

@ -72,6 +72,7 @@ from lib.core.settings import URI_INJECTABLE_REGEX
from lib.core.settings import USER_AGENT_ALIASES from lib.core.settings import USER_AGENT_ALIASES
from lib.core.settings import XML_RECOGNITION_REGEX from lib.core.settings import XML_RECOGNITION_REGEX
from lib.utils.hashdb import HashDB from lib.utils.hashdb import HashDB
from lib.utils.xrange import xrange
from thirdparty.odict import OrderedDict from thirdparty.odict import OrderedDict
from thirdparty.six.moves import urllib as _urllib from thirdparty.six.moves import urllib as _urllib

View File

@ -25,6 +25,7 @@ from lib.core.exception import SqlmapUserQuitException
from lib.core.exception import SqlmapValueException from lib.core.exception import SqlmapValueException
from lib.core.settings import MAX_NUMBER_OF_THREADS from lib.core.settings import MAX_NUMBER_OF_THREADS
from lib.core.settings import PYVERSION from lib.core.settings import PYVERSION
from lib.utils.xrange import xrange
shared = AttribDict() shared = AttribDict()

View File

@ -39,6 +39,7 @@ from lib.core.shell import autoCompletion
from lib.core.shell import clearHistory from lib.core.shell import clearHistory
from lib.core.shell import loadHistory from lib.core.shell import loadHistory
from lib.core.shell import saveHistory from lib.core.shell import saveHistory
from lib.utils.xrange import xrange
def cmdLineParser(argv=None): def cmdLineParser(argv=None):
""" """

View File

@ -16,6 +16,7 @@ from lib.core.data import paths
from lib.core.datatype import AttribDict from lib.core.datatype import AttribDict
from lib.core.exception import SqlmapInstallationException from lib.core.exception import SqlmapInstallationException
from lib.core.settings import PAYLOAD_XML_FILES from lib.core.settings import PAYLOAD_XML_FILES
from lib.utils.xrange import xrange
def cleanupVals(text, tag): def cleanupVals(text, tag):
if tag == "clause" and '-' in text: if tag == "clause" and '-' in text:

View File

@ -118,6 +118,7 @@ from lib.request.basic import processResponse
from lib.request.direct import direct from lib.request.direct import direct
from lib.request.comparison import comparison from lib.request.comparison import comparison
from lib.request.methodrequest import MethodRequest from lib.request.methodrequest import MethodRequest
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.odict import OrderedDict from thirdparty.odict import OrderedDict
from thirdparty.six.moves import http_client as _http_client from thirdparty.six.moves import http_client as _http_client

View File

@ -59,6 +59,7 @@ from lib.techniques.dns.test import dnsTest
from lib.techniques.dns.use import dnsUse from lib.techniques.dns.use import dnsUse
from lib.techniques.error.use import errorUse from lib.techniques.error.use import errorUse
from lib.techniques.union.use import unionUse from lib.techniques.union.use import unionUse
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
def _goDns(payload, expression): def _goDns(payload, expression):

View File

@ -27,6 +27,7 @@ from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.core.exception import SqlmapUserQuitException from lib.core.exception import SqlmapUserQuitException
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
class UDF: class UDF:
""" """

View File

@ -51,6 +51,7 @@ from lib.core.settings import SHELL_RUNCMD_EXE_TAG
from lib.core.settings import SHELL_WRITABLE_DIR_TAG from lib.core.settings import SHELL_WRITABLE_DIR_TAG
from lib.core.settings import VIEWSTATE_REGEX from lib.core.settings import VIEWSTATE_REGEX
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.xrange import xrange
from thirdparty.six.moves import urllib as _urllib from thirdparty.six.moves import urllib as _urllib
class Web: class Web:

View File

@ -32,6 +32,7 @@ from lib.core.enums import HASHDB_KEYS
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
from lib.utils.xrange import xrange
from lib.request import inject from lib.request import inject
class XP_cmdshell: class XP_cmdshell:

View File

@ -32,6 +32,7 @@ from lib.core.settings import MAX_DNS_LABEL
from lib.core.settings import PARTIAL_VALUE_MARKER from lib.core.settings import PARTIAL_VALUE_MARKER
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.xrange import xrange
def dnsUse(payload, expression): def dnsUse(payload, expression):
""" """

View File

@ -57,6 +57,7 @@ from lib.core.threads import runThreads
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.progress import ProgressBar from lib.utils.progress import ProgressBar
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
def _oneShotErrorUse(expression, field=None, chunkTest=False): def _oneShotErrorUse(expression, field=None, chunkTest=False):

View File

@ -42,6 +42,7 @@ from lib.core.settings import ORDER_BY_STEP
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.comparison import comparison from lib.request.comparison import comparison
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.xrange import xrange
def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=PAYLOAD.WHERE.ORIGINAL): def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=PAYLOAD.WHERE.ORIGINAL):
""" """

View File

@ -59,6 +59,7 @@ from lib.core.threads import runThreads
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.progress import ProgressBar from lib.utils.progress import ProgressBar
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.odict import OrderedDict from thirdparty.odict import OrderedDict

View File

@ -47,6 +47,7 @@ from lib.core.settings import RESTAPI_DEFAULT_PORT
from lib.core.shell import autoCompletion from lib.core.shell import autoCompletion
from lib.core.subprocessng import Popen from lib.core.subprocessng import Popen
from lib.parse.cmdline import cmdLineParser from lib.parse.cmdline import cmdLineParser
from lib.utils.xrange import xrange
from thirdparty.bottle.bottle import error as return_error from thirdparty.bottle.bottle import error as return_error
from thirdparty.bottle.bottle import get from thirdparty.bottle.bottle import get
from thirdparty.bottle.bottle import hook from thirdparty.bottle.bottle import hook

View File

@ -31,6 +31,7 @@ from lib.core.threads import getCurrentThreadData
from lib.core.threads import runThreads from lib.core.threads import runThreads
from lib.parse.sitemap import parseSitemap from lib.parse.sitemap import parseSitemap
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.xrange import xrange
from thirdparty.beautifulsoup.beautifulsoup import BeautifulSoup from thirdparty.beautifulsoup.beautifulsoup import BeautifulSoup
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 urllib as _urllib from thirdparty.six.moves import urllib as _urllib

View File

@ -86,6 +86,7 @@ from lib.core.settings import NULL
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from lib.core.settings import ROTATING_CHARS from lib.core.settings import ROTATING_CHARS
from lib.core.wordlist import Wordlist from lib.core.wordlist import Wordlist
from lib.utils.xrange import xrange
from thirdparty import six from thirdparty import six
from thirdparty.colorama.initialise import init as coloramainit from thirdparty.colorama.initialise import init as coloramainit
from thirdparty.pydes.pyDes import des from thirdparty.pydes.pyDes import des

View File

@ -25,6 +25,7 @@ from lib.core.settings import HASHDB_RETRIEVE_RETRIES
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
from lib.core.threads import getCurrentThreadName from lib.core.threads import getCurrentThreadName
from lib.utils.xrange import xrange
class HashDB(object): class HashDB(object):
def __init__(self, filepath): def __init__(self, filepath):

View File

@ -31,6 +31,7 @@ from lib.core.settings import MAX_INT
from lib.core.settings import NULL from lib.core.settings import NULL
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
def pivotDumpTable(table, colList, count=None, blind=True, alias=None): def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
lengths = {} lengths = {}

View File

@ -13,6 +13,7 @@ import string
from lib.core.common import getSafeExString from lib.core.common import getSafeExString
from lib.core.data import logger from lib.core.data import logger
from lib.utils.xrange import xrange
def purge(directory): def purge(directory):
""" """

View File

@ -1,10 +1,12 @@
#!/usr/bin/env python2 #!/usr/bin/env python
""" """
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/) Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import numbers
class xrange(object): class xrange(object):
""" """
Advanced (re)implementation of xrange (supports slice/copy/etc.) Advanced (re)implementation of xrange (supports slice/copy/etc.)
@ -68,7 +70,7 @@ class xrange(object):
start, stop, step = index.indices(self._len()) start, stop, step = index.indices(self._len())
return xrange(self._index(start), return xrange(self._index(start),
self._index(stop), step * self.step) self._index(stop), step * self.step)
elif isinstance(index, (int, long)): elif isinstance(index, numbers.Integral):
if index < 0: if index < 0:
fixed_index = index + self._len() fixed_index = index + self._len()
else: else:

View File

@ -15,6 +15,7 @@ from lib.core.enums import OS
from lib.core.session import setDbms from lib.core.session import setDbms
from lib.core.settings import DB2_ALIASES from lib.core.settings import DB2_ALIASES
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint): class Fingerprint(GenericFingerprint):

View File

@ -19,6 +19,7 @@ from lib.core.session import setDbms
from lib.core.settings import FIREBIRD_ALIASES from lib.core.settings import FIREBIRD_ALIASES
from lib.core.settings import METADB_SUFFIX from lib.core.settings import METADB_SUFFIX
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint): class Fingerprint(GenericFingerprint):

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
""" """
from lib.utils.xrange import xrange
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):

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
""" """
from lib.utils.xrange import xrange
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):

View File

@ -16,6 +16,7 @@ from lib.core.session import setDbms
from lib.core.settings import MAXDB_ALIASES from lib.core.settings import MAXDB_ALIASES
from lib.request import inject from lib.request import inject
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.xrange import xrange
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint): class Fingerprint(GenericFingerprint):

View File

@ -28,6 +28,7 @@ from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapNoneDataException from lib.core.exception import SqlmapNoneDataException
from lib.core.settings import CURRENT_DB from lib.core.settings import CURRENT_DB
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.enumeration import Enumeration as GenericEnumeration from plugins.generic.enumeration import Enumeration as GenericEnumeration
from thirdparty import six from thirdparty import six

View File

@ -24,6 +24,7 @@ from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapNoneDataException from lib.core.exception import SqlmapNoneDataException
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.filesystem import Filesystem as GenericFilesystem from plugins.generic.filesystem import Filesystem as GenericFilesystem

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
""" """
from lib.utils.xrange import xrange
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):

View File

@ -11,6 +11,7 @@ from lib.core.common import Backend
from lib.core.data import logger from lib.core.data import logger
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.takeover import Takeover as GenericTakeover from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover): class Takeover(GenericTakeover):

View File

@ -26,6 +26,7 @@ from lib.core.exception import SqlmapNoneDataException
from lib.request import inject from lib.request import inject
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.techniques.union.use import unionUse from lib.techniques.union.use import unionUse
from lib.utils.xrange import xrange
from plugins.generic.filesystem import Filesystem as GenericFilesystem from plugins.generic.filesystem import Filesystem as GenericFilesystem
class Filesystem(GenericFilesystem): class Filesystem(GenericFilesystem):

View File

@ -21,6 +21,7 @@ from lib.core.enums import OS
from lib.core.session import setDbms from lib.core.session import setDbms
from lib.core.settings import MYSQL_ALIASES from lib.core.settings import MYSQL_ALIASES
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint): class Fingerprint(GenericFingerprint):

View File

@ -21,6 +21,7 @@ from lib.core.enums import EXPECTED
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapNoneDataException from lib.core.exception import SqlmapNoneDataException
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.enumeration import Enumeration as GenericEnumeration from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration): class Enumeration(GenericEnumeration):

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
""" """
from lib.utils.xrange import xrange
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):

View File

@ -12,6 +12,7 @@ from lib.core.data import logger
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.core.settings import LOBLKSIZE from lib.core.settings import LOBLKSIZE
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.filesystem import Filesystem as GenericFilesystem from plugins.generic.filesystem import Filesystem as GenericFilesystem
class Filesystem(GenericFilesystem): class Filesystem(GenericFilesystem):

View File

@ -16,6 +16,7 @@ from lib.core.enums import OS
from lib.core.session import setDbms from lib.core.session import setDbms
from lib.core.settings import SYBASE_ALIASES from lib.core.settings import SYBASE_ALIASES
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint): class Fingerprint(GenericFingerprint):

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
""" """
from lib.utils.xrange import xrange
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):

View File

@ -31,6 +31,7 @@ from lib.core.exception import SqlmapUndefinedMethod
from lib.core.settings import TAKEOVER_TABLE_PREFIX from lib.core.settings import TAKEOVER_TABLE_PREFIX
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from lib.request import inject from lib.request import inject
from lib.utils.xrange import xrange
class Filesystem: class Filesystem:
""" """
@ -70,7 +71,7 @@ class Filesystem:
sameFile = None sameFile = None
if isNumPosStrValue(remoteFileSize): if isNumPosStrValue(remoteFileSize):
remoteFileSize = long(remoteFileSize) remoteFileSize = int(remoteFileSize)
localFile = getUnicode(localFile, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) localFile = getUnicode(localFile, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)
sameFile = False sameFile = False

View File

@ -42,6 +42,7 @@ from lib.request import inject
from lib.utils.hash import attackCachedUsersPasswords from lib.utils.hash import attackCachedUsersPasswords
from lib.utils.hash import storeHashesToFile from lib.utils.hash import storeHashesToFile
from lib.utils.pivotdumptable import pivotDumpTable from lib.utils.pivotdumptable import pivotDumpTable
from lib.utils.xrange import xrange
class Users: class Users:
""" """

View File

@ -6,6 +6,7 @@ See the file 'doc/COPYING' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.HIGHEST __priority__ = PRIORITY.HIGHEST

View File

@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.HIGHEST __priority__ = PRIORITY.HIGHEST

View File

@ -11,6 +11,7 @@ import random
from lib.core.enums import HINT from lib.core.enums import HINT
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.core.settings import DEFAULT_GET_POST_DELIMITER from lib.core.settings import DEFAULT_GET_POST_DELIMITER
from lib.utils.xrange import xrange
__priority__ = PRIORITY.NORMAL __priority__ = PRIORITY.NORMAL

View File

@ -12,6 +12,7 @@ from lib.core.common import singleTimeWarnMessage
from lib.core.common import zeroDepthSearch from lib.core.common import zeroDepthSearch
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.HIGHEST __priority__ = PRIORITY.HIGHEST

View File

@ -12,6 +12,7 @@ from lib.core.common import singleTimeWarnMessage
from lib.core.common import zeroDepthSearch from lib.core.common import zeroDepthSearch
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.HIGHEST __priority__ = PRIORITY.HIGHEST

View File

@ -10,6 +10,7 @@ import re
from lib.core.common import randomRange from lib.core.common import randomRange
from lib.core.data import kb from lib.core.data import kb
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.NORMAL __priority__ = PRIORITY.NORMAL

View File

@ -10,6 +10,7 @@ import re
from lib.core.common import randomRange from lib.core.common import randomRange
from lib.core.data import kb from lib.core.data import kb
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -9,6 +9,7 @@ import random
import string import string
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -12,6 +12,7 @@ import string
from lib.core.common import singleTimeWarnMessage from lib.core.common import singleTimeWarnMessage
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -15,6 +15,7 @@ from lib.core.data import kb
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -11,6 +11,7 @@ import random
from lib.core.common import singleTimeWarnMessage from lib.core.common import singleTimeWarnMessage
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -11,6 +11,7 @@ import random
from lib.core.common import singleTimeWarnMessage from lib.core.common import singleTimeWarnMessage
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -10,6 +10,7 @@ import os
from lib.core.common import singleTimeWarnMessage from lib.core.common import singleTimeWarnMessage
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission
""" """
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -8,6 +8,7 @@ See the file 'LICENSE' for copying permission
import random import random
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.LOW __priority__ = PRIORITY.LOW

View File

@ -8,6 +8,7 @@ See the file 'LICENSE' for copying permission
import re import re
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.utils.xrange import xrange
__priority__ = PRIORITY.NORMAL __priority__ = PRIORITY.NORMAL

View File

@ -5,8 +5,11 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import random
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from random import sample from lib.utils.xrange import xrange
__priority__ = PRIORITY.NORMAL __priority__ = PRIORITY.NORMAL
def dependencies(): def dependencies():
@ -16,7 +19,7 @@ def randomIP():
numbers = [] numbers = []
while not numbers or numbers[0] in (10, 172, 192): while not numbers or numbers[0] in (10, 172, 192):
numbers = sample(xrange(1, 255), 4) numbers = random.sample(xrange(1, 255), 4)
return '.'.join(str(_) for _ in numbers) return '.'.join(str(_) for _ in numbers)

View File

@ -87,6 +87,10 @@ __license__ = "New-style BSD"
import codecs import codecs
import types import types
import re import re
import sys
if sys.version_info.major > 2:
xrange = range
try: try:
from htmlentitydefs import name2codepoint from htmlentitydefs import name2codepoint

View File

@ -33,6 +33,8 @@ from .chardistribution import EUCJPDistributionAnalysis
from .jpcntx import EUCJPContextAnalysis from .jpcntx import EUCJPContextAnalysis
from .mbcssm import EUCJPSMModel from .mbcssm import EUCJPSMModel
if sys.version_info.major > 2:
xrange = range
class EUCJPProber(MultiByteCharSetProber): class EUCJPProber(MultiByteCharSetProber):
def __init__(self): def __init__(self):

View File

@ -31,6 +31,8 @@ import sys
from . import constants from . import constants
from .charsetprober import CharSetProber from .charsetprober import CharSetProber
if sys.version_info.major > 2:
xrange = range
class MultiByteCharSetProber(CharSetProber): class MultiByteCharSetProber(CharSetProber):
def __init__(self): def __init__(self):

View File

@ -33,6 +33,8 @@ from .jpcntx import SJISContextAnalysis
from .mbcssm import SJISSMModel from .mbcssm import SJISSMModel
from . import constants from . import constants
if sys.version_info.major > 2:
xrange = range
class SJISProber(MultiByteCharSetProber): class SJISProber(MultiByteCharSetProber):
def __init__(self): def __init__(self):

View File

@ -25,11 +25,15 @@
# 02110-1301 USA # 02110-1301 USA
######################### END LICENSE BLOCK ######################### ######################### END LICENSE BLOCK #########################
import sys
from . import constants from . import constants
from .charsetprober import CharSetProber from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine from .codingstatemachine import CodingStateMachine
from .mbcssm import UTF8SMModel from .mbcssm import UTF8SMModel
if sys.version_info.major > 2:
xrange = range
ONE_CHAR_PROB = 0.5 ONE_CHAR_PROB = 0.5

View File

@ -109,6 +109,9 @@ except ImportError:
import sys, types, copy, re, random import sys, types, copy, re, random
if sys.version_info.major > 2:
xrange = range
# monkeypatch to fix http://www.python.org/sf/803422 :-( # monkeypatch to fix http://www.python.org/sf/803422 :-(
sgmllib.charref = re.compile("&#(x?[0-9a-fA-F]+)[^0-9a-fA-F]") sgmllib.charref = re.compile("&#(x?[0-9a-fA-F]+)[^0-9a-fA-F]")

View File

@ -119,8 +119,10 @@ __all__ = ['crypt']
# ----- END fcrypt.c LICENSE ----- # ----- END fcrypt.c LICENSE -----
import string, struct import string, struct, sys
if sys.version_info.major > 2:
xrange = range
_ITERATIONS = 16 _ITERATIONS = 16

View File

@ -29,8 +29,11 @@ import os.path
import re import re
import textwrap import textwrap
import optparse import optparse
import sys
import xml.parsers.expat import xml.parsers.expat
if sys.version_info.major > 2:
xrange = range
try: try:
# Debugging helper module # Debugging helper module

View File

@ -113,7 +113,7 @@ except ImportError:
from six.moves import urllib as _urllib from six.moves import urllib as _urllib
import socket import socket
import thread import threading
DEBUG = None DEBUG = None
@ -127,7 +127,7 @@ class ConnectionManager:
* keep track of all existing * keep track of all existing
""" """
def __init__(self): def __init__(self):
self._lock = thread.allocate_lock() self._lock = threading.Lock()
self._hostmap = {} # map hosts to a list of connections self._hostmap = {} # map hosts to a list of connections
self._connmap = {} # map connections to host self._connmap = {} # map connections to host
self._readymap = {} # map connection to ready state self._readymap = {} # map connection to ready state

View File

@ -29,6 +29,7 @@ import colorsys
import time import time
import re import re
import optparse import optparse
import sys
import gobject import gobject
import gtk import gtk
@ -38,6 +39,8 @@ import cairo
import pango import pango
import pangocairo import pangocairo
if sys.version_info.major > 2:
xrange = range
# See http://www.graphviz.org/pub/scm/graphviz-cairo/plugin/cairo/gvrender_cairo.c # See http://www.graphviz.org/pub/scm/graphviz-cairo/plugin/cairo/gvrender_cairo.c