From b3bd4144f52635cdb93f28c438b9c0455b35ca2e Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 22 Feb 2012 10:40:11 +0000 Subject: [PATCH] removing of unused imports together with some general code refactoring --- _sqlmap.py | 1 - lib/controller/checks.py | 10 +- lib/controller/handler.py | 4 +- lib/core/agent.py | 2 - lib/core/common.py | 14 +- lib/core/convert.py | 5 - lib/core/option.py | 4 - lib/core/replication.py | 4 +- lib/core/revision.py | 2 +- lib/core/session.py | 6 - lib/core/settings.py | 7 +- lib/core/shell.py | 4 +- lib/core/target.py | 5 +- lib/core/testing.py | 1 - lib/core/update.py | 7 - lib/parse/banner.py | 2 - lib/parse/cmdline.py | 17 +- lib/request/basic.py | 7 +- lib/request/connect.py | 10 +- lib/request/direct.py | 3 - lib/takeover/abstraction.py | 4 +- lib/takeover/icmpsh.py | 1 - lib/takeover/metasploit.py | 3 - lib/takeover/web.py | 2 - lib/takeover/xp_cmdshell.py | 2 - lib/techniques/blind/inference.py | 10 +- lib/techniques/brute/use.py | 7 - lib/techniques/error/use.py | 8 +- lib/techniques/union/test.py | 7 - lib/techniques/union/use.py | 4 +- lib/utils/checkpayload.py | 1 - lib/utils/crawler.py | 7 +- lib/utils/deps.py | 2 - lib/utils/google.py | 7 +- lib/utils/hash.py | 16 +- lib/utils/hashdb.py | 1 - lib/utils/resume.py | 1 - plugins/dbms/access/__init__.py | 1 - plugins/dbms/access/connector.py | 2 - plugins/dbms/access/filesystem.py | 1 - plugins/dbms/access/fingerprint.py | 6 +- plugins/dbms/access/takeover.py | 1 - plugins/dbms/db2/connector.py | 125 +++++++------ plugins/dbms/db2/filesystem.py | 35 ++-- plugins/dbms/db2/fingerprint.py | 223 ++++++++++++------------ plugins/dbms/db2/takeover.py | 47 ++--- plugins/dbms/firebird/__init__.py | 1 - plugins/dbms/firebird/connector.py | 1 - plugins/dbms/firebird/filesystem.py | 1 - plugins/dbms/firebird/fingerprint.py | 3 - plugins/dbms/firebird/takeover.py | 1 - plugins/dbms/maxdb/__init__.py | 1 - plugins/dbms/maxdb/connector.py | 1 - plugins/dbms/maxdb/enumeration.py | 3 - plugins/dbms/maxdb/filesystem.py | 1 - plugins/dbms/maxdb/fingerprint.py | 7 +- plugins/dbms/maxdb/syntax.py | 1 - plugins/dbms/maxdb/takeover.py | 1 - plugins/dbms/mssqlserver/__init__.py | 1 - plugins/dbms/mssqlserver/connector.py | 1 - plugins/dbms/mssqlserver/enumeration.py | 1 - plugins/dbms/mssqlserver/filesystem.py | 1 - plugins/dbms/mssqlserver/fingerprint.py | 4 - plugins/dbms/mssqlserver/syntax.py | 1 - plugins/dbms/mssqlserver/takeover.py | 2 - plugins/dbms/mysql/__init__.py | 1 - plugins/dbms/mysql/connector.py | 1 - plugins/dbms/mysql/filesystem.py | 1 - plugins/dbms/mysql/fingerprint.py | 4 - plugins/dbms/mysql/takeover.py | 1 - plugins/dbms/oracle/__init__.py | 1 - plugins/dbms/oracle/connector.py | 5 +- plugins/dbms/oracle/enumeration.py | 4 - plugins/dbms/oracle/filesystem.py | 1 - plugins/dbms/oracle/fingerprint.py | 3 - plugins/dbms/oracle/takeover.py | 1 - plugins/dbms/postgresql/__init__.py | 1 - plugins/dbms/postgresql/connector.py | 1 - plugins/dbms/postgresql/enumeration.py | 1 - plugins/dbms/postgresql/filesystem.py | 1 - plugins/dbms/postgresql/fingerprint.py | 5 - plugins/dbms/postgresql/takeover.py | 1 - plugins/dbms/sqlite/__init__.py | 1 - plugins/dbms/sqlite/connector.py | 1 - plugins/dbms/sqlite/filesystem.py | 1 - plugins/dbms/sqlite/fingerprint.py | 3 - plugins/dbms/sqlite/syntax.py | 1 - plugins/dbms/sqlite/takeover.py | 1 - plugins/dbms/sybase/__init__.py | 1 - plugins/dbms/sybase/connector.py | 1 - plugins/dbms/sybase/enumeration.py | 1 - plugins/dbms/sybase/filesystem.py | 1 - plugins/dbms/sybase/fingerprint.py | 4 - plugins/dbms/sybase/syntax.py | 1 - plugins/dbms/sybase/takeover.py | 1 - plugins/generic/enumeration.py | 16 +- plugins/generic/filesystem.py | 4 - plugins/generic/fingerprint.py | 1 - plugins/generic/misc.py | 2 - plugins/generic/takeover.py | 1 - tamper/charencode.py | 1 - tamper/space2dash.py | 2 - tamper/space2mssqlhash.py | 2 - tamper/unmagicquotes.py | 2 - 104 files changed, 255 insertions(+), 499 deletions(-) diff --git a/_sqlmap.py b/_sqlmap.py index 94905abbc..31fc6476d 100755 --- a/_sqlmap.py +++ b/_sqlmap.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import codecs import os import sys import time diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 3a4bf0d2f..808ebc211 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -8,13 +8,11 @@ See the file 'doc/COPYING' for copying permission """ import httplib -import logging import re import socket import time from lib.core.agent import agent -from lib.core.common import aliasToDbmsEnum from lib.core.common import arrayizeValue from lib.core.common import Backend from lib.core.common import beep @@ -22,7 +20,6 @@ from lib.core.common import extractRegexResult from lib.core.common import findDynamicContent from lib.core.common import Format from lib.core.common import getComparePageRatio -from lib.core.common import getCompiledRegex from lib.core.common import getLastRequestHTTPError from lib.core.common import getSortedInjectionTests from lib.core.common import getUnicode @@ -36,13 +33,11 @@ from lib.core.common import randomStr from lib.core.common import readInput from lib.core.common import showStaticWords from lib.core.common import singleTimeWarnMessage -from lib.core.common import trimAlphaNum from lib.core.common import wasLastRequestDBMSError from lib.core.common import wasLastRequestHTTPError from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.data import paths from lib.core.datatype import AttribDict from lib.core.datatype import InjectionDict from lib.core.enums import HTTPHEADER @@ -51,7 +46,6 @@ from lib.core.enums import NULLCONNECTION from lib.core.enums import PAYLOAD from lib.core.enums import PLACE from lib.core.exception import sqlmapConnectionException -from lib.core.exception import sqlmapGenericException from lib.core.exception import sqlmapNoneDataException from lib.core.exception import sqlmapSilentQuitException from lib.core.exception import sqlmapUserQuitException @@ -614,7 +608,7 @@ def heuristicCheckSqlInjection(place, parameter): def simpletonCheckSqlInjection(place, parameter, value): """ - This is a function for the quickest and simplest + This is a function for the quickest and simplest sql injection check (e.g. AND 1=1) - only works with integer parameters """ @@ -879,7 +873,7 @@ def checkWaf(): conf.parameters[PLACE.GET] += "%s=%d %s" % (randomStr(), randomInt(), IDS_WAF_CHECK_PAYLOAD) kb.matchRatio = None - _ = Request.queryPage() + Request.queryPage() if kb.errorIsNone and kb.matchRatio is None: kb.matchRatio = LOWER_RATIO_BOUND diff --git a/lib/controller/handler.py b/lib/controller/handler.py index 529ad783e..fec752d97 100644 --- a/lib/controller/handler.py +++ b/lib/controller/handler.py @@ -11,9 +11,7 @@ from lib.core.common import Backend from lib.core.common import popValue from lib.core.common import pushValue from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger -from lib.core.enums import DBMS from lib.core.settings import MSSQL_ALIASES from lib.core.settings import MYSQL_ALIASES from lib.core.settings import ORACLE_ALIASES @@ -64,7 +62,7 @@ def setHandler(): ( FIREBIRD_ALIASES, FirebirdMap, FirebirdConn ), ( MAXDB_ALIASES, MaxDBMap, MaxDBConn ), ( SYBASE_ALIASES, SybaseMap, SybaseConn ), - ( DB2_ALIASES, DB2Map, DB2Conn ) + ( DB2_ALIASES, DB2Map, DB2Conn ) ] if Backend.getIdentifiedDbms() is not None: diff --git a/lib/core/agent.py b/lib/core/agent.py index 9f65a925b..07261b5fc 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -18,11 +18,9 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import randomInt from lib.core.common import randomStr from lib.core.common import singleTimeWarnMessage -from lib.core.convert import urlencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import queries -from lib.core.datatype import AttribDict from lib.core.enums import DBMS from lib.core.enums import PAYLOAD from lib.core.enums import PLACE diff --git a/lib/core/common.py b/lib/core/common.py index aea439e21..06498ec77 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -14,7 +14,6 @@ import httplib import inspect import logging import ntpath -import optparse import os import pickle import posixpath @@ -25,7 +24,6 @@ import string import struct import sys import time -import types import urllib import urlparse import unicodedata @@ -49,14 +47,13 @@ from extra.clientform.clientform import ParseError from extra.cloak.cloak import decloak from extra.magic import magic from extra.odict.odict import OrderedDict +from extra.safe2bin.safe2bin import safecharencode from lib.core.bigarray import BigArray from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths -from lib.core.data import queries from lib.core.convert import htmlunescape -from lib.core.convert import safecharencode from lib.core.convert import unicodeencode from lib.core.convert import urldecode from lib.core.convert import urlencode @@ -120,7 +117,6 @@ from lib.core.settings import TIME_STDEV_COEFF from lib.core.settings import DYNAMICITY_MARK_LENGTH from lib.core.settings import REFLECTIVE_MISS_THRESHOLD from lib.core.settings import SENSITIVE_DATA_REGEX -from lib.core.settings import SUPPORTED_OS from lib.core.settings import UNION_UNIQUE_FIFO_LENGTH from lib.core.settings import URI_INJECTION_MARK_CHAR from lib.core.settings import URI_QUESTION_MARKER @@ -403,7 +399,7 @@ class Backend: 1. Sort the tests, getSortedInjectionTests() - detection phase. 2. Ask user whether or not skip specific DBMS tests in detection phase, lib/controller/checks.py - detection phase. - 3. Sort the fingerprint of the DBMS, lib/controller/handler.py - + 3. Sort the fingerprint of the DBMS, lib/controller/handler.py - fingerprint phase. """ @@ -869,7 +865,7 @@ def randomStr(length=4, lowercase=False, alphabet=None): """ if alphabet: - rndStr = "".join(random.choice(alphabet) for _ in xrange(0, length)) + rndStr = "".join(random.choice(alphabet) for _ in xrange(0, length)) elif lowercase: rndStr = "".join(random.choice(string.lowercase) for _ in xrange(0, length)) else: @@ -1670,7 +1666,7 @@ def readXmlFile(xmlFile): Reads XML file content and returns it's DOM representation """ - checkFile(xmlFile) + checkFile(xmlFile) with codecs.open(xmlFile, 'r', UNICODE_ENCODING) as f: retVal = minidom.parse(f).documentElement @@ -2179,7 +2175,7 @@ def enumValueToNameLookup(type_, value_): def extractRegexResult(regex, content, flags=0): """ - Returns 'result' group value from a possible match with regex on a given + Returns 'result' group value from a possible match with regex on a given content """ diff --git a/lib/core/convert.py b/lib/core/convert.py index 518960a51..bf5351030 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -13,19 +13,14 @@ except: import md5 import sha -import binascii import pickle import re import sys -import string import struct import urllib -from extra.safe2bin.safe2bin import safecharencode -from extra.safe2bin.safe2bin import safechardecode from lib.core.data import conf from lib.core.data import kb -from lib.core.data import logger from lib.core.enums import PLACE from lib.core.settings import UNICODE_ENCODING from lib.core.settings import URLENCODE_CHAR_LIMIT diff --git a/lib/core/option.py b/lib/core/option.py index 9e530153a..db64c140c 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import codecs import cookielib -import difflib import inspect import logging import os @@ -44,7 +43,6 @@ from lib.core.common import parseTargetUrl from lib.core.common import paths from lib.core.common import randomRange from lib.core.common import randomStr -from lib.core.common import readCachedFileContent from lib.core.common import readInput from lib.core.common import runningAsAdmin from lib.core.common import sanitizeStr @@ -55,7 +53,6 @@ from lib.core.convert import urlencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.data import paths from lib.core.data import queries from lib.core.datatype import AttribDict from lib.core.datatype import InjectionDict @@ -87,7 +84,6 @@ from lib.core.settings import DEFAULT_TOR_HTTP_PORTS from lib.core.settings import DEFAULT_TOR_SOCKS_PORT from lib.core.settings import IS_WIN from lib.core.settings import NULL -from lib.core.settings import PLATFORM from lib.core.settings import PYVERSION from lib.core.settings import SITE from lib.core.settings import DBMS_DICT diff --git a/lib/core/replication.py b/lib/core/replication.py index d1ef40c7e..e3ee308e0 100644 --- a/lib/core/replication.py +++ b/lib/core/replication.py @@ -7,8 +7,8 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ +from extra.safe2bin.safe2bin import safechardecode from lib.core.common import unsafeSQLIdentificatorNaming -from lib.core.convert import safechardecode from lib.core.exception import sqlmapMissingDependence from lib.core.exception import sqlmapValueException @@ -21,7 +21,7 @@ class Replication: def __init__(self, dbpath): try: import sqlite3 - except ImportError, _: + except ImportError: errMsg = "missing module 'sqlite3' needed by switch '--replicate'" raise sqlmapMissingDependence, errMsg diff --git a/lib/core/revision.py b/lib/core/revision.py index ebc341c9c..1293c156c 100644 --- a/lib/core/revision.py +++ b/lib/core/revision.py @@ -23,7 +23,7 @@ def getRevisionNumber(): client = pysvn.Client() if client.info(curDir): retVal = client.info(curDir).revision.number - except ImportError, _: + except ImportError: process = execute("svn info %s" % curDir, shell=True, stdout=PIPE, stderr=PIPE) svnStdout, svnStderr = process.communicate() diff --git a/lib/core/session.py b/lib/core/session.py index 7f4230e6f..08fa79742 100644 --- a/lib/core/session.py +++ b/lib/core/session.py @@ -12,7 +12,6 @@ import re from lib.core.common import Backend from lib.core.common import Format from lib.core.common import dataToSessionFile -from lib.core.common import getFilteredPageContent from lib.core.common import intersect from lib.core.common import readInput from lib.core.common import singleTimeWarnMessage @@ -21,12 +20,7 @@ from lib.core.convert import base64unpickle from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.datatype import InjectionDict -from lib.core.enums import DBMS from lib.core.enums import OS -from lib.core.enums import PAYLOAD -from lib.core.enums import PLACE -from lib.core.settings import METADB_SUFFIX from lib.core.settings import SUPPORTED_DBMS from lib.core.settings import UNKNOWN_DBMS_VERSION diff --git a/lib/core/settings.py b/lib/core/settings.py index 3f9d2918e..559cf7f53 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -15,7 +15,6 @@ import sys from lib.core.enums import CUSTOM_LOGGING from lib.core.enums import DBMS from lib.core.enums import DBMS_DIRECTORY_NAME -from lib.core.enums import PLACE from lib.core.revision import getRevisionNumber # sqlmap version and site @@ -258,9 +257,9 @@ NULL = "NULL" CURRENT_DB = "CD" # Regular expressions used for parsing error messages (--parse-errors) -ERROR_PARSING_REGEXES = ( - r"[^<]*(fatal|error|warning|exception)[^<]*:?\s*(?P.+?)", - r"
  • Error Type:
    (?P.+?)
  • ", +ERROR_PARSING_REGEXES = ( + r"[^<]*(fatal|error|warning|exception)[^<]*:?\s*(?P.+?)", + r"
  • Error Type:
    (?P.+?)
  • ", r"error '[0-9a-f]{8}'((<[^>]+>)|\s)+(?P[^<>]+)" ) diff --git a/lib/core/shell.py b/lib/core/shell.py index 5e4264e03..ca99f6d9b 100644 --- a/lib/core/shell.py +++ b/lib/core/shell.py @@ -13,10 +13,8 @@ import rlcompleter from lib.core import readlineng as readline from lib.core.common import Backend -from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths -from lib.core.data import queries from lib.core.enums import OS def saveHistory(): @@ -70,7 +68,7 @@ def autoCompletion(sqlShell=False, osShell=False): else: # Reference: http://en.wikipedia.org/wiki/List_of_Unix_commands completer = CompleterNG({ - "cp": None, "rm": None, "ls": None, + "cp": None, "rm": None, "ls": None, "echo": None, "mkdir": None, "free": None, "mv": None, "ifconfig": None, "netstat -natu": None, "pwd": None, "uname": None, "id": None, diff --git a/lib/core/target.py b/lib/core/target.py index 3787f408b..63bad5a3a 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -45,7 +45,6 @@ from lib.core.settings import URI_INJECTION_MARK_CHAR from lib.core.settings import USER_AGENT_ALIASES from lib.utils.hashdb import HashDB from lib.core.xmldump import dumper as xmldumper -from lib.request.connect import Connect as Request def __setRequestParams(): """ @@ -289,7 +288,7 @@ def __setOutputResume(): def __setResultsFile(): """ - Create results file for storing results of running in a + Create results file for storing results of running in a multiple target mode. """ @@ -374,7 +373,7 @@ def __createTargetDirs(): def __restoreCmdLineOptions(): """ - Restore command line options that could be possibly + Restore command line options that could be possibly changed during the testing of previous target. """ conf.regexp = cmdLineOptions.regexp diff --git a/lib/core/testing.py b/lib/core/testing.py index 2de19e0be..a99e80cd5 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ import doctest -import logging import os import re import shutil diff --git a/lib/core/update.py b/lib/core/update.py index df5a4b312..eedfbad5c 100644 --- a/lib/core/update.py +++ b/lib/core/update.py @@ -7,14 +7,9 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import os import re -import shutil -import sys import time -from distutils.dir_util import mkpath - from subprocess import PIPE from subprocess import Popen as execute @@ -23,11 +18,9 @@ from lib.core.common import getUnicode from lib.core.data import conf from lib.core.data import logger from lib.core.data import paths -from lib.core.exception import sqlmapFilePathException from lib.core.settings import IS_WIN from lib.core.settings import UNICODE_ENCODING from lib.core.subprocessng import pollProcess -from lib.request.connect import Connect as Request def update(): if not conf.updateAll: diff --git a/lib/parse/banner.py b/lib/parse/banner.py index 6a030c756..07bc7bdbc 100644 --- a/lib/parse/banner.py +++ b/lib/parse/banner.py @@ -7,8 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import re - from xml.sax.handler import ContentHandler from lib.core.common import checkFile diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 6a35de77c..9a9132eda 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -20,7 +20,6 @@ from lib.core.data import logger from lib.core.defaults import defaults from lib.core.settings import IS_WIN from lib.core.settings import VERSION_STRING -from lib.core.settings import UNICODE_ENCODING def cmdLineParser(): """ @@ -33,7 +32,7 @@ def cmdLineParser(): parser = OptionParser(usage=usage, version=VERSION_STRING) try: - parser.add_option("-v", dest="verbose", type="int", + parser.add_option("-v", dest="verbose", type="int", help="Verbosity level: 0-6 (default %d)" % defaults.verbose) # Target options @@ -138,10 +137,10 @@ def cmdLineParser(): help="Retries when the connection timeouts " "(default %d)" % defaults.retries) - request.add_option("--scope", dest="scope", + request.add_option("--scope", dest="scope", help="Regexp to filter targets from provided proxy log") - request.add_option("--safe-url", dest="safUrl", + request.add_option("--safe-url", dest="safUrl", help="Url address to visit frequently during testing") request.add_option("--safe-freq", dest="saFreq", type="int", @@ -494,7 +493,7 @@ def cmdLineParser(): general.add_option("--charset", dest="charset", help="Force character encoding used for data retrieval") - general.add_option("--check-tor", dest="checkTor", + general.add_option("--check-tor", dest="checkTor", action="store_true", help="Check to see if Tor is used properly") @@ -538,14 +537,14 @@ def cmdLineParser(): action="store_true", help="Save options to a configuration INI file") - general.add_option("--tor", dest="tor", + general.add_option("--tor", dest="tor", action="store_true", help="Use Tor anonymity network") - general.add_option("--tor-port", dest="torPort", + general.add_option("--tor-port", dest="torPort", help="Set Tor proxy port other than default") - general.add_option("--tor-type", dest="torType", + general.add_option("--tor-type", dest="torType", help="Set Tor proxy type (HTTP - default, SOCKS4 or SOCKS5)") general.add_option("--update", dest="updateAll", @@ -665,7 +664,7 @@ def cmdLineParser(): except (OptionError, TypeError), e: parser.error(e) - except SystemExit, _: + except SystemExit: # Protection against Windows dummy double clicking if IS_WIN: print "\nPress Enter to continue...", diff --git a/lib/request/basic.py b/lib/request/basic.py index a5ae3c97d..24fecfa27 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission import codecs import gzip import logging -import os import re import StringIO import zlib @@ -19,8 +18,6 @@ from extra.chardet import detect from lib.core.common import extractErrorMessage from lib.core.common import extractRegexResult from lib.core.common import getUnicode -from lib.core.common import isWindowsDriveLetterPath -from lib.core.common import posixToNtSlashes from lib.core.common import readInput from lib.core.common import singleTimeLogMessage from lib.core.data import conf @@ -28,12 +25,10 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.enums import HTTPHEADER from lib.core.enums import PLACE -from lib.core.exception import sqlmapDataException from lib.core.settings import DEFAULT_COOKIE_DELIMITER from lib.core.settings import ML from lib.core.settings import META_CHARSET_REGEX from lib.core.settings import PARSE_HEADERS_LIMIT -from lib.core.settings import UNICODE_ENCODING from lib.parse.headers import headersParser from lib.parse.html import htmlParser @@ -229,4 +224,4 @@ def processResponse(page, responseHeaders): msg = extractErrorMessage(page) if msg: - logger.info("parsed error message: '%s'" % msg) + logger.info("parsed error message: '%s'" % msg) diff --git a/lib/request/connect.py b/lib/request/connect.py index 5e30f0007..092d2683e 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -20,18 +20,15 @@ from extra.multipart import multipartpost from lib.core.agent import agent from lib.core.common import asciifyUrl -from lib.core.common import average from lib.core.common import calculateDeltaSeconds from lib.core.common import clearConsoleLine from lib.core.common import cpuThrottle from lib.core.common import evaluateCode from lib.core.common import extractRegexResult from lib.core.common import getCurrentThreadData -from lib.core.common import getFilteredPageContent from lib.core.common import getHostHeader from lib.core.common import getUnicode from lib.core.common import logHTTPTraffic -from lib.core.common import parseTargetUrl from lib.core.common import randomizeParameterValue from lib.core.common import readInput from lib.core.common import removeReflectiveValues @@ -61,7 +58,6 @@ from lib.core.settings import MIN_TIME_RESPONSES from lib.core.settings import WARN_TIME_STDEV from lib.core.settings import UNENCODED_ORIGINAL_VALUE from lib.core.settings import URI_HTTP_HEADER -from lib.core.threads import getCurrentThreadData from lib.request.basic import decodePage from lib.request.basic import forgeHeaders from lib.request.basic import processResponse @@ -171,7 +167,6 @@ class Connect: url = url.replace(" ", "%20") page = None - cookieStr = u"" requestMsg = u"HTTP request [#%d]:\n%s " % (threadData.lastRequestUID, method or (HTTPMETHOD.POST if post else HTTPMETHOD.GET)) requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/" responseMsg = u"HTTP response " @@ -203,7 +198,7 @@ class Connect: requestMsg += "?%s" % params elif multipart: - # Needed in this form because of potential circle dependency + # Needed in this form because of potential circle dependency # problem (option -> update -> connect -> option) from lib.core.option import proxyHandler @@ -563,7 +558,7 @@ class Connect: elif place: if place in (PLACE.GET, PLACE.POST, PLACE.URI): - # payloads in GET and/or POST need to be urlencoded + # payloads in GET and/or POST need to be urlencoded # throughly without safe chars (especially & and =) # addendum: as we support url encoding in tampering # functions therefore we need to use % as a safe char @@ -619,7 +614,6 @@ class Connect: for randomParameter in conf.rParam: for item in [PLACE.GET, PLACE.POST, PLACE.COOKIE]: if item in conf.parameters: - origValue = conf.parameters[item] if item == PLACE.GET and get: get = _randomizeParameter(get, randomParameter) elif item == PLACE.POST and post: diff --git a/lib/request/direct.py b/lib/request/direct.py index 995ebac4c..eae735b48 100644 --- a/lib/request/direct.py +++ b/lib/request/direct.py @@ -10,14 +10,11 @@ See the file 'doc/COPYING' for copying permission import time from lib.core.agent import agent -from lib.core.common import dataToSessionFile from lib.core.common import Backend from lib.core.common import calculateDeltaSeconds from lib.core.common import getCurrentThreadData from lib.core.common import getUnicode -from lib.core.convert import base64pickle from lib.core.convert import base64unpickle -from lib.core.convert import utf8decode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger diff --git a/lib/takeover/abstraction.py b/lib/takeover/abstraction.py index 10cbaa446..33fe286ed 100644 --- a/lib/takeover/abstraction.py +++ b/lib/takeover/abstraction.py @@ -7,16 +7,14 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ +from extra.safe2bin.safe2bin import safechardecode from lib.core.common import dataToStdout from lib.core.common import Backend from lib.core.common import isTechniqueAvailable from lib.core.common import readInput -from lib.core.convert import safechardecode from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.enums import DBMS -from lib.core.enums import OS from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapUnsupportedFeatureException from lib.core.shell import autoCompletion diff --git a/lib/takeover/icmpsh.py b/lib/takeover/icmpsh.py index 4efffcde2..c430c7162 100644 --- a/lib/takeover/icmpsh.py +++ b/lib/takeover/icmpsh.py @@ -19,7 +19,6 @@ from lib.core.common import ntToPosixSlashes from lib.core.common import randomStr from lib.core.common import readInput from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths diff --git a/lib/takeover/metasploit.py b/lib/takeover/metasploit.py index bad7fe80f..d721dcf01 100644 --- a/lib/takeover/metasploit.py +++ b/lib/takeover/metasploit.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission import codecs import os import re -import stat import sys import time @@ -29,7 +28,6 @@ from lib.core.common import randomRange from lib.core.common import randomStr from lib.core.common import readInput from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths from lib.core.enums import DBMS @@ -41,7 +39,6 @@ from lib.core.subprocessng import blockingReadFromFD from lib.core.subprocessng import blockingWriteToFD from lib.core.subprocessng import pollProcess from lib.core.subprocessng import setNonBlocking -from lib.request.connect import Connect as Request class Metasploit: diff --git a/lib/takeover/web.py b/lib/takeover/web.py index 7318e0ecf..2aa3b56b3 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -34,8 +34,6 @@ from lib.core.data import logger from lib.core.data import paths from lib.core.enums import OS from lib.core.enums import PAYLOAD -from lib.core.exception import sqlmapUnsupportedDBMSException -from lib.core.shell import autoCompletion from lib.request.connect import Connect as Request diff --git a/lib/takeover/xp_cmdshell.py b/lib/takeover/xp_cmdshell.py index e9672be83..5a6d384e5 100644 --- a/lib/takeover/xp_cmdshell.py +++ b/lib/takeover/xp_cmdshell.py @@ -10,13 +10,11 @@ See the file 'doc/COPYING' for copying permission from lib.core.common import Backend from lib.core.common import getSPLSnippet from lib.core.common import randomStr -from lib.core.common import readCachedFileContent from lib.core.common import readInput from lib.core.common import wasLastRequestDelayed from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.data import paths from lib.core.enums import DBMS from lib.core.exception import sqlmapUnsupportedFeatureException from lib.core.session import setXpCmdshellAvailability diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 038ad4105..eadb602ca 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -9,8 +9,8 @@ See the file 'doc/COPYING' for copying permission import threading import time -import traceback +from extra.safe2bin.safe2bin import safecharencode from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import dataToStdout @@ -22,21 +22,14 @@ from lib.core.common import getCounter from lib.core.common import goGoodSamaritan from lib.core.common import getPartRun from lib.core.common import incrementCounter -from lib.core.common import popValue -from lib.core.common import pushValue -from lib.core.common import replaceNewlineTabs from lib.core.common import safeStringFormat from lib.core.common import singleTimeWarnMessage -from lib.core.common import unhandledExceptionMessage -from lib.core.convert import safecharencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries from lib.core.enums import DBMS from lib.core.enums import PAYLOAD -from lib.core.exception import sqlmapConnectionException -from lib.core.exception import sqlmapValueException from lib.core.exception import sqlmapThreadException from lib.core.progress import ProgressBar from lib.core.settings import CHAR_INFERENCE_MARK @@ -47,7 +40,6 @@ from lib.core.settings import INFERENCE_EQUALS_CHAR from lib.core.settings import INFERENCE_NOT_EQUALS_CHAR from lib.core.settings import MAX_TIME_REVALIDATION_STEPS from lib.core.settings import PARTIAL_VALUE_MARKER -from lib.core.settings import PYVERSION from lib.core.threads import getCurrentThreadData from lib.core.threads import runThreads from lib.core.unescaper import unescaper diff --git a/lib/techniques/brute/use.py b/lib/techniques/brute/use.py index ee20fc716..9c71a68b2 100644 --- a/lib/techniques/brute/use.py +++ b/lib/techniques/brute/use.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import threading import time from lib.core.common import clearConsoleLine @@ -16,11 +15,8 @@ from lib.core.common import filterListValue from lib.core.common import getFileItems from lib.core.common import Backend from lib.core.common import getPageWordSet -from lib.core.common import popValue -from lib.core.common import pushValue from lib.core.common import randomInt from lib.core.common import randomStr -from lib.core.common import readInput from lib.core.common import safeStringFormat from lib.core.common import safeSQLIdentificatorNaming from lib.core.data import conf @@ -30,12 +26,9 @@ from lib.core.enums import DBMS from lib.core.enums import HASHDB_KEYS from lib.core.exception import sqlmapDataException from lib.core.exception import sqlmapMissingMandatoryOptionException -from lib.core.exception import sqlmapThreadException -from lib.core.settings import MAX_NUMBER_OF_THREADS from lib.core.settings import METADB_SUFFIX from lib.core.settings import BRUTE_COLUMN_EXISTS_TEMPLATE from lib.core.settings import BRUTE_TABLE_EXISTS_TEMPLATE -from lib.core.session import safeFormatString from lib.core.threads import getCurrentThreadData from lib.core.threads import runThreads from lib.request import inject diff --git a/lib/techniques/error/use.py b/lib/techniques/error/use.py index a3e6eefa0..b5a0c8570 100644 --- a/lib/techniques/error/use.py +++ b/lib/techniques/error/use.py @@ -8,9 +8,9 @@ See the file 'doc/COPYING' for copying permission """ import re -import threading import time +from extra.safe2bin.safe2bin import safecharencode from lib.core.agent import agent from lib.core.bigarray import BigArray from lib.core.common import Backend @@ -23,19 +23,14 @@ from lib.core.common import incrementCounter from lib.core.common import initTechnique from lib.core.common import isNumPosStrValue from lib.core.common import listToStrValue -from lib.core.common import randomInt from lib.core.common import readInput -from lib.core.common import safeStringFormat from lib.core.convert import htmlunescape -from lib.core.convert import safecharencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries from lib.core.enums import DBMS -from lib.core.enums import EXPECTED from lib.core.enums import PAYLOAD -from lib.core.exception import sqlmapConnectionException from lib.core.settings import FROM_DUMMY_TABLE from lib.core.settings import MYSQL_ERROR_CHUNK_LENGTH from lib.core.settings import MSSQL_ERROR_CHUNK_LENGTH @@ -203,7 +198,6 @@ def errorUse(expression, expected=None, dump=False): output = None outputs = [] untilLimitChar = None - untilOrderChar = None _, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(expression) diff --git a/lib/techniques/union/test.py b/lib/techniques/union/test.py index eee0dbfbc..e7d7d02f8 100644 --- a/lib/techniques/union/test.py +++ b/lib/techniques/union/test.py @@ -9,15 +9,10 @@ See the file 'doc/COPYING' for copying permission import random import re -import time from lib.core.agent import agent from lib.core.common import average from lib.core.common import Backend -from lib.core.common import clearConsoleLine -from lib.core.common import dataToStdout -from lib.core.common import extractRegexResult -from lib.core.common import getUnicode from lib.core.common import isNullValue from lib.core.common import listToStrValue from lib.core.common import popValue @@ -32,8 +27,6 @@ from lib.core.common import wasLastRequestDBMSError from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.data import queries -from lib.core.enums import DBMS from lib.core.enums import PAYLOAD from lib.core.settings import FROM_DUMMY_TABLE from lib.core.settings import UNION_MIN_RESPONSE_CHARS diff --git a/lib/techniques/union/use.py b/lib/techniques/union/use.py index dcd7142c8..1e0def827 100644 --- a/lib/techniques/union/use.py +++ b/lib/techniques/union/use.py @@ -8,9 +8,9 @@ See the file 'doc/COPYING' for copying permission """ import re -import threading import time +from extra.safe2bin.safe2bin import safecharencode from lib.core.agent import agent from lib.core.bigarray import BigArray from lib.core.common import Backend @@ -27,14 +27,12 @@ from lib.core.common import listToStrValue from lib.core.common import parseUnionPage from lib.core.common import removeReflectiveValues from lib.core.common import singleTimeWarnMessage -from lib.core.convert import safecharencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries from lib.core.enums import DBMS from lib.core.enums import PAYLOAD -from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapSyntaxException from lib.core.settings import FROM_DUMMY_TABLE from lib.core.settings import SQL_SCALAR_REGEX diff --git a/lib/utils/checkpayload.py b/lib/utils/checkpayload.py index 081ad6f2f..cc05ebea6 100644 --- a/lib/utils/checkpayload.py +++ b/lib/utils/checkpayload.py @@ -12,7 +12,6 @@ import re from lib.core.common import getCompiledRegex from lib.core.common import readXmlFile from lib.core.convert import urldecode -from lib.core.data import conf from lib.core.data import paths from lib.core.data import logger diff --git a/lib/utils/crawler.py b/lib/utils/crawler.py index e4674bafc..d2bdf93f3 100644 --- a/lib/utils/crawler.py +++ b/lib/utils/crawler.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import httplib import re -import threading import urlparse import time @@ -73,16 +72,16 @@ class Crawler: for tag in soup('a'): if tag.get("href"): url = urlparse.urljoin(conf.url, tag.get("href")) - + # flag to know if we are dealing with the same target host target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url])) - + if conf.scope: if not re.search(conf.scope, url, re.I): continue elif not target: continue - + if url.split('.')[-1].lower() not in CRAWL_EXCLUDE_EXTENSIONS: kb.locks.outputs.acquire() threadData.shared.deeper.add(url) diff --git a/lib/utils/deps.py b/lib/utils/deps.py index 6485da488..f40a3e996 100644 --- a/lib/utils/deps.py +++ b/lib/utils/deps.py @@ -7,10 +7,8 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.data import conf from lib.core.data import logger from lib.core.enums import DBMS -from lib.core.exception import sqlmapMissingDependence from lib.core.settings import DBMS_DICT from lib.core.settings import IS_WIN diff --git a/lib/utils/google.py b/lib/utils/google.py index 2a996e1d4..5aa69a770 100644 --- a/lib/utils/google.py +++ b/lib/utils/google.py @@ -15,7 +15,6 @@ import urllib2 from lib.core.common import getUnicode from lib.core.common import readInput -from lib.core.convert import htmlunescape from lib.core.convert import urldecode from lib.core.convert import urlencode from lib.core.data import conf @@ -51,7 +50,7 @@ class Google: retVal = re.findall(GOOGLE_REGEX, page, re.I | re.S) - return retVal + return retVal def getTargetUrls(self): """ @@ -84,7 +83,7 @@ class Google: _ = conn.info() except urllib2.HTTPError, e: _ = e.info() - except urllib2.URLError, _: + except urllib2.URLError: errMsg = "unable to connect to Google" raise sqlmapConnectionException, errMsg @@ -134,7 +133,7 @@ class Google: warnMsg += "to get error page information (%d)" % e.code logger.critical(warnMsg) return None - except (urllib2.URLError, socket.error, socket.timeout), _: + except (urllib2.URLError, socket.error, socket.timeout): errMsg = "unable to connect to Google" raise sqlmapConnectionException, errMsg diff --git a/lib/utils/hash.py b/lib/utils/hash.py index 05ce13fb9..88c652fff 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -23,14 +23,11 @@ except (ImportError, OSError): else: _multiprocessing = multiprocessing -import os -import re import time from hashlib import md5 from hashlib import sha1 from Queue import Queue -from zipfile import ZipFile from extra.pydes.pyDes import des from extra.pydes.pyDes import CBC @@ -63,7 +60,6 @@ from lib.core.settings import HASH_MOD_ITEM_DISPLAY from lib.core.settings import HASH_RECOGNITION_QUIT_THRESHOLD from lib.core.settings import IS_WIN from lib.core.settings import ITOA64 -from lib.core.settings import PYVERSION from lib.core.settings import ML from lib.core.settings import UNICODE_ENCODING from lib.core.settings import ROTATING_CHARS @@ -289,14 +285,14 @@ def wordpress_passwd(password, salt, count, prefix, uppercase=False): return retVal.upper() if uppercase else retVal __functions__ = { - HASH.MYSQL: mysql_passwd, + HASH.MYSQL: mysql_passwd, HASH.MYSQL_OLD: mysql_old_passwd, - HASH.POSTGRES: postgres_passwd, - HASH.MSSQL: mssql_passwd, - HASH.MSSQL_OLD: mssql_old_passwd, + HASH.POSTGRES: postgres_passwd, + HASH.MSSQL: mssql_passwd, + HASH.MSSQL_OLD: mssql_old_passwd, HASH.ORACLE: oracle_passwd, - HASH.ORACLE_OLD: oracle_old_passwd, - HASH.MD5_GENERIC: md5_generic_passwd, + HASH.ORACLE_OLD: oracle_old_passwd, + HASH.MD5_GENERIC: md5_generic_passwd, HASH.SHA1_GENERIC: sha1_generic_passwd, HASH.CRYPT_GENERIC: crypt_generic_passwd, HASH.WORDPRESS: wordpress_passwd diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index e36c29d67..ae0a716a7 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -13,7 +13,6 @@ import threading from lib.core.common import serializeObject from lib.core.common import unserializeObject -from lib.core.data import conf from lib.core.settings import HASHDB_FLUSH_THRESHOLD from lib.core.settings import UNICODE_ENCODING from lib.core.threads import getCurrentThreadData diff --git a/lib/utils/resume.py b/lib/utils/resume.py index c8c6b934a..5632f9217 100644 --- a/lib/utils/resume.py +++ b/lib/utils/resume.py @@ -24,7 +24,6 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries from lib.core.enums import DBMS -from lib.core.enums import PAYLOAD from lib.core.unescaper import unescaper from lib.techniques.blind.inference import bisection diff --git a/plugins/dbms/access/__init__.py b/plugins/dbms/access/__init__.py index 324da6f48..af673b64a 100644 --- a/plugins/dbms/access/__init__.py +++ b/plugins/dbms/access/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import ACCESS_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.access.enumeration import Enumeration from plugins.dbms.access.filesystem import Filesystem from plugins.dbms.access.fingerprint import Fingerprint diff --git a/plugins/dbms/access/connector.py b/plugins/dbms/access/connector.py index 73d6a07bb..3f50c0ef0 100644 --- a/plugins/dbms/access/connector.py +++ b/plugins/dbms/access/connector.py @@ -12,12 +12,10 @@ try: except ImportError, _: pass -from lib.core.data import conf from lib.core.data import logger from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapUnsupportedFeatureException from lib.core.settings import IS_WIN - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/access/filesystem.py b/plugins/dbms/access/filesystem.py index 787b2f98b..7f27977b3 100644 --- a/plugins/dbms/access/filesystem.py +++ b/plugins/dbms/access/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/access/fingerprint.py b/plugins/dbms/access/fingerprint.py index bfef7dbf7..48580fa59 100644 --- a/plugins/dbms/access/fingerprint.py +++ b/plugins/dbms/access/fingerprint.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import re -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.common import getCurrentThreadData @@ -23,10 +22,7 @@ from lib.core.enums import DBMS from lib.core.session import setDbms from lib.core.settings import ACCESS_ALIASES from lib.core.settings import METADB_SUFFIX -from lib.core.threads import getCurrentThreadData from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): @@ -54,7 +50,7 @@ class Fingerprint(GenericFingerprint): logger.info(infoMsg) # Microsoft Access table reference updated on 01/2010 - sysTables = { + sysTables = { "97": ("MSysModules2", "MSysAccessObjects"), "2000" : ("!MSysModules2", "MSysAccessObjects"), "2002-2003" : ("MSysAccessStorage", "!MSysNavPaneObjectIDs"), diff --git a/plugins/dbms/access/takeover.py b/plugins/dbms/access/takeover.py index 1016ffde1..2fdf003bc 100644 --- a/plugins/dbms/access/takeover.py +++ b/plugins/dbms/access/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/db2/connector.py b/plugins/dbms/db2/connector.py index b46e241a3..b1073d508 100644 --- a/plugins/dbms/db2/connector.py +++ b/plugins/dbms/db2/connector.py @@ -1,63 +1,62 @@ -#!/usr/bin/env python - -""" -$Id$ - -Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) -See the file 'doc/COPYING' for copying permission -""" - -try: - import ibm_db_dbi -except ImportError, _: - pass - -from lib.core.data import logger -from lib.core.exception import sqlmapConnectionException - -from plugins.generic.connector import Connector as GenericConnector - -class Connector(GenericConnector): - """ - Homepage: http://code.google.com/p/ibm-db/ - User guide: http://code.google.com/p/ibm-db/wiki/README - API: http://www.python.org/dev/peps/pep-0249/ - License: Apache License 2.0 - """ - - def __init__(self): - GenericConnector.__init__(self) - - def connect(self): - self.initConnection() - - try: - database = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port) - self.connector = ibm_db_dbi.connect(database, self.user, self.password) - except ibm_db_dbi.OperationalError, msg: - raise sqlmapConnectionException, msg - - - self.setCursor() - self.connected() - - def fetchall(self): - try: - return self.cursor.fetchall() - except ibm_db_dbi.ProgrammingError, msg: - logger.warn("(remote) %s" % msg[1]) - return None - - def execute(self, query): - try: - self.cursor.execute(query) - except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError), msg: - logger.warn("(remote) %s" % msg[1]) - except ibm_db_dbi.InternalError, msg: - raise sqlmapConnectionException, msg[1] - - self.connector.commit() - - def select(self, query): - self.execute(query) - return self.fetchall() +#!/usr/bin/env python + +""" +$Id$ + +Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +try: + import ibm_db_dbi +except ImportError, _: + pass + +from lib.core.data import logger +from lib.core.exception import sqlmapConnectionException +from plugins.generic.connector import Connector as GenericConnector + +class Connector(GenericConnector): + """ + Homepage: http://code.google.com/p/ibm-db/ + User guide: http://code.google.com/p/ibm-db/wiki/README + API: http://www.python.org/dev/peps/pep-0249/ + License: Apache License 2.0 + """ + + def __init__(self): + GenericConnector.__init__(self) + + def connect(self): + self.initConnection() + + try: + database = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port) + self.connector = ibm_db_dbi.connect(database, self.user, self.password) + except ibm_db_dbi.OperationalError, msg: + raise sqlmapConnectionException, msg + + + self.setCursor() + self.connected() + + def fetchall(self): + try: + return self.cursor.fetchall() + except ibm_db_dbi.ProgrammingError, msg: + logger.warn("(remote) %s" % msg[1]) + return None + + def execute(self, query): + try: + self.cursor.execute(query) + except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError), msg: + logger.warn("(remote) %s" % msg[1]) + except ibm_db_dbi.InternalError, msg: + raise sqlmapConnectionException, msg[1] + + self.connector.commit() + + def select(self, query): + self.execute(query) + return self.fetchall() diff --git a/plugins/dbms/db2/filesystem.py b/plugins/dbms/db2/filesystem.py index ff5760145..2469d0e05 100644 --- a/plugins/dbms/db2/filesystem.py +++ b/plugins/dbms/db2/filesystem.py @@ -1,23 +1,14 @@ -#!/usr/bin/env python - -""" +#!/usr/bin/env python + +""" $Id$ - -Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) -See the file 'doc/COPYING' for copying permission -""" - -from lib.core.common import randomStr -from lib.core.data import conf -from lib.core.data import kb -from lib.core.data import logger -from lib.core.enums import PLACE -from lib.core.exception import sqlmapNoneDataException -from lib.request import inject -#from lib.techniques.inband.union.use import unionUse - -from plugins.generic.filesystem import Filesystem as GenericFilesystem - -class Filesystem(GenericFilesystem): - def __init__(self): - GenericFilesystem.__init__(self) + +Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +from plugins.generic.filesystem import Filesystem as GenericFilesystem + +class Filesystem(GenericFilesystem): + def __init__(self): + GenericFilesystem.__init__(self) diff --git a/plugins/dbms/db2/fingerprint.py b/plugins/dbms/db2/fingerprint.py index aa5eb360a..99659417c 100644 --- a/plugins/dbms/db2/fingerprint.py +++ b/plugins/dbms/db2/fingerprint.py @@ -1,113 +1,112 @@ -#!/usr/bin/env python - -""" +#!/usr/bin/env python + +""" $Id$ - -Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) -See the file 'doc/COPYING' for copying permission -""" - - -from lib.core.common import Backend -from lib.core.common import Format -from lib.core.common import randomInt -from lib.core.data import conf -from lib.core.data import kb -from lib.core.data import logger -from lib.core.enums import DBMS -from lib.core.session import setDbms -from lib.core.settings import DB2_ALIASES -from lib.request import inject - -from plugins.generic.fingerprint import Fingerprint as GenericFingerprint - -class Fingerprint(GenericFingerprint): - def __init__(self): - GenericFingerprint.__init__(self, DBMS.DB2) - - def __versionCheck(self): - minor, major = None, None - - for version in reversed(xrange(5, 15)): - result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM sysibm.sysversions WHERE versionnumber BETWEEN %d000000 AND %d999999)>0" % (version, version)) - - if result: - major = version - - for version in reversed(xrange(0, 20)): - result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM sysibm.sysversions WHERE versionnumber BETWEEN %d%02d0000 AND %d%02d9999)>0" % (major, version, major, version)) - if result: - minor = version - version = "%s.%s" % (major, minor) - break - - break - - if major and minor: - return "%s.%s" % (major, minor) - else: - return None - - def getFingerprint(self): - value = "" - wsOsFp = Format.getOs("web server", kb.headersFp) - - if wsOsFp: - value += "%s\n" % wsOsFp - - if kb.data.banner: - dbmsOsFp = Format.getOs("back-end DBMS", kb.bannerFp) - - if dbmsOsFp: - value += "%s\n" % dbmsOsFp - - value += "back-end DBMS: " - - if not conf.extensiveFp: - value += DBMS.DB2 - return value - - actVer = Format.getDbms() - blank = " " * 15 - value += "active fingerprint: %s" % actVer - - if kb.bannerFp: - banVer = kb.bannerFp["dbmsVersion"] if 'dbmsVersion' in kb.bannerFp else None - banVer = Format.getDbms([banVer]) - value += "\n%sbanner parsing fingerprint: %s" % (blank, banVer) - - htmlErrorFp = Format.getErrorParsedDBMSes() - - if htmlErrorFp: - value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp) - - return value - - def checkDbms(self): - if not conf.extensiveFp and (Backend.isDbmsWithin(DB2_ALIASES) or conf.dbms in DB2_ALIASES): - setDbms(DBMS.DB2) - - return True - - logMsg = "testing %s" % DBMS.DB2 - logger.info(logMsg) - - randInt = randomInt() - result = inject.checkBooleanExpression("%d=(SELECT %d FROM SYSIBM.SYSDUMMY1)" % (randInt, randInt)) - - if result: - logMsg = "confirming %s" % DBMS.DB2 - logger.info(logMsg) - - version = self.__versionCheck() - - if version: - Backend.setVersion(version) - setDbms("%s %s" % (DBMS.DB2, Backend.getVersion())) - - return True - else: - warnMsg = "the back-end DBMS is not %s" % DBMS.DB2 - logger.warn(warnMsg) - - return False + +Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + + +from lib.core.common import Backend +from lib.core.common import Format +from lib.core.common import randomInt +from lib.core.data import conf +from lib.core.data import kb +from lib.core.data import logger +from lib.core.enums import DBMS +from lib.core.session import setDbms +from lib.core.settings import DB2_ALIASES +from lib.request import inject +from plugins.generic.fingerprint import Fingerprint as GenericFingerprint + +class Fingerprint(GenericFingerprint): + def __init__(self): + GenericFingerprint.__init__(self, DBMS.DB2) + + def __versionCheck(self): + minor, major = None, None + + for version in reversed(xrange(5, 15)): + result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM sysibm.sysversions WHERE versionnumber BETWEEN %d000000 AND %d999999)>0" % (version, version)) + + if result: + major = version + + for version in reversed(xrange(0, 20)): + result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM sysibm.sysversions WHERE versionnumber BETWEEN %d%02d0000 AND %d%02d9999)>0" % (major, version, major, version)) + if result: + minor = version + version = "%s.%s" % (major, minor) + break + + break + + if major and minor: + return "%s.%s" % (major, minor) + else: + return None + + def getFingerprint(self): + value = "" + wsOsFp = Format.getOs("web server", kb.headersFp) + + if wsOsFp: + value += "%s\n" % wsOsFp + + if kb.data.banner: + dbmsOsFp = Format.getOs("back-end DBMS", kb.bannerFp) + + if dbmsOsFp: + value += "%s\n" % dbmsOsFp + + value += "back-end DBMS: " + + if not conf.extensiveFp: + value += DBMS.DB2 + return value + + actVer = Format.getDbms() + blank = " " * 15 + value += "active fingerprint: %s" % actVer + + if kb.bannerFp: + banVer = kb.bannerFp["dbmsVersion"] if 'dbmsVersion' in kb.bannerFp else None + banVer = Format.getDbms([banVer]) + value += "\n%sbanner parsing fingerprint: %s" % (blank, banVer) + + htmlErrorFp = Format.getErrorParsedDBMSes() + + if htmlErrorFp: + value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp) + + return value + + def checkDbms(self): + if not conf.extensiveFp and (Backend.isDbmsWithin(DB2_ALIASES) or conf.dbms in DB2_ALIASES): + setDbms(DBMS.DB2) + + return True + + logMsg = "testing %s" % DBMS.DB2 + logger.info(logMsg) + + randInt = randomInt() + result = inject.checkBooleanExpression("%d=(SELECT %d FROM SYSIBM.SYSDUMMY1)" % (randInt, randInt)) + + if result: + logMsg = "confirming %s" % DBMS.DB2 + logger.info(logMsg) + + version = self.__versionCheck() + + if version: + Backend.setVersion(version) + setDbms("%s %s" % (DBMS.DB2, Backend.getVersion())) + + return True + else: + warnMsg = "the back-end DBMS is not %s" % DBMS.DB2 + logger.warn(warnMsg) + + return False diff --git a/plugins/dbms/db2/takeover.py b/plugins/dbms/db2/takeover.py index f3add747b..8a0777670 100644 --- a/plugins/dbms/db2/takeover.py +++ b/plugins/dbms/db2/takeover.py @@ -1,32 +1,17 @@ -#!/usr/bin/env python - -""" +#!/usr/bin/env python + +""" $Id$ - -Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) -See the file 'doc/COPYING' for copying permission -""" - -import re - -from lib.core.agent import agent -from lib.core.common import isTechniqueAvailable -from lib.core.common import normalizePath -from lib.core.common import ntToPosixSlashes -from lib.core.common import randomStr -from lib.core.common import readInput -from lib.core.data import kb -from lib.core.data import logger -from lib.core.data import paths -from lib.core.enums import PAYLOAD -from lib.request import inject -from lib.request.connect import Connect as Request - -from plugins.generic.takeover import Takeover as GenericTakeover - -class Takeover(GenericTakeover): - def __init__(self): - self.__basedir = None - self.__datadir = None - - GenericTakeover.__init__(self) \ No newline at end of file + +Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +from plugins.generic.takeover import Takeover as GenericTakeover + +class Takeover(GenericTakeover): + def __init__(self): + self.__basedir = None + self.__datadir = None + + GenericTakeover.__init__(self) diff --git a/plugins/dbms/firebird/__init__.py b/plugins/dbms/firebird/__init__.py index 9bb0140c2..6d8110504 100644 --- a/plugins/dbms/firebird/__init__.py +++ b/plugins/dbms/firebird/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import FIREBIRD_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.firebird.enumeration import Enumeration from plugins.dbms.firebird.filesystem import Filesystem from plugins.dbms.firebird.fingerprint import Fingerprint diff --git a/plugins/dbms/firebird/connector.py b/plugins/dbms/firebird/connector.py index 5a29f83a9..b3f63c7e9 100644 --- a/plugins/dbms/firebird/connector.py +++ b/plugins/dbms/firebird/connector.py @@ -15,7 +15,6 @@ except ImportError, _: from lib.core.data import logger from lib.core.exception import sqlmapConnectionException from lib.core.settings import UNICODE_ENCODING - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/firebird/filesystem.py b/plugins/dbms/firebird/filesystem.py index 73af18930..861452f95 100644 --- a/plugins/dbms/firebird/filesystem.py +++ b/plugins/dbms/firebird/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/firebird/fingerprint.py b/plugins/dbms/firebird/fingerprint.py index f362f098d..ef3290415 100644 --- a/plugins/dbms/firebird/fingerprint.py +++ b/plugins/dbms/firebird/fingerprint.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import re -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.common import getUnicode @@ -24,8 +23,6 @@ from lib.core.settings import FIREBIRD_ALIASES from lib.core.settings import METADB_SUFFIX from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/firebird/takeover.py b/plugins/dbms/firebird/takeover.py index a4ba66ec7..06e0dceb0 100644 --- a/plugins/dbms/firebird/takeover.py +++ b/plugins/dbms/firebird/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/maxdb/__init__.py b/plugins/dbms/maxdb/__init__.py index 342dc9152..3e4dec32a 100644 --- a/plugins/dbms/maxdb/__init__.py +++ b/plugins/dbms/maxdb/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import MAXDB_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.maxdb.enumeration import Enumeration from plugins.dbms.maxdb.filesystem import Filesystem from plugins.dbms.maxdb.fingerprint import Fingerprint diff --git a/plugins/dbms/maxdb/connector.py b/plugins/dbms/maxdb/connector.py index ef78d0008..0bf2baa4e 100644 --- a/plugins/dbms/maxdb/connector.py +++ b/plugins/dbms/maxdb/connector.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/maxdb/enumeration.py b/plugins/dbms/maxdb/enumeration.py index 5d1d2a4b4..fd7df5acc 100644 --- a/plugins/dbms/maxdb/enumeration.py +++ b/plugins/dbms/maxdb/enumeration.py @@ -8,16 +8,13 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.common import Backend -from lib.core.common import isTechniqueAvailable from lib.core.common import randomStr from lib.core.common import safeSQLIdentificatorNaming -from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries -from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapMissingMandatoryOptionException from lib.core.exception import sqlmapNoneDataException from lib.core.settings import CURRENT_DB diff --git a/plugins/dbms/maxdb/filesystem.py b/plugins/dbms/maxdb/filesystem.py index 818eec728..e41c1499e 100644 --- a/plugins/dbms/maxdb/filesystem.py +++ b/plugins/dbms/maxdb/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/maxdb/fingerprint.py b/plugins/dbms/maxdb/fingerprint.py index 1d5ebc492..4da99573a 100644 --- a/plugins/dbms/maxdb/fingerprint.py +++ b/plugins/dbms/maxdb/fingerprint.py @@ -7,13 +7,9 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import re - from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format -from lib.core.common import randomInt -from lib.core.common import randomRange from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -22,7 +18,6 @@ from lib.core.session import setDbms from lib.core.settings import MAXDB_ALIASES from lib.request import inject from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): @@ -140,4 +135,4 @@ class Fingerprint(GenericFingerprint): conf.db = "USER" if conf.tbl: - conf.tbl = conf.tbl.upper() + conf.tbl = conf.tbl.upper() diff --git a/plugins/dbms/maxdb/syntax.py b/plugins/dbms/maxdb/syntax.py index af9964138..82ec20bca 100644 --- a/plugins/dbms/maxdb/syntax.py +++ b/plugins/dbms/maxdb/syntax.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.exception import sqlmapSyntaxException from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/dbms/maxdb/takeover.py b/plugins/dbms/maxdb/takeover.py index 42dc32002..d69e2efdb 100644 --- a/plugins/dbms/maxdb/takeover.py +++ b/plugins/dbms/maxdb/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/mssqlserver/__init__.py b/plugins/dbms/mssqlserver/__init__.py index ca205bea4..57379c262 100644 --- a/plugins/dbms/mssqlserver/__init__.py +++ b/plugins/dbms/mssqlserver/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import MSSQL_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.mssqlserver.enumeration import Enumeration from plugins.dbms.mssqlserver.filesystem import Filesystem from plugins.dbms.mssqlserver.fingerprint import Fingerprint diff --git a/plugins/dbms/mssqlserver/connector.py b/plugins/dbms/mssqlserver/connector.py index ce0e85e7d..dd260eda4 100644 --- a/plugins/dbms/mssqlserver/connector.py +++ b/plugins/dbms/mssqlserver/connector.py @@ -17,7 +17,6 @@ from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.data import logger from lib.core.exception import sqlmapConnectionException - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py index fe7b60237..7a965b9b2 100644 --- a/plugins/dbms/mssqlserver/enumeration.py +++ b/plugins/dbms/mssqlserver/enumeration.py @@ -16,7 +16,6 @@ from lib.core.common import isNoneValue from lib.core.common import isNumPosStrValue from lib.core.common import isTechniqueAvailable from lib.core.common import safeSQLIdentificatorNaming -from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.data import conf from lib.core.data import kb diff --git a/plugins/dbms/mssqlserver/filesystem.py b/plugins/dbms/mssqlserver/filesystem.py index c0ce6ea21..df9311a14 100644 --- a/plugins/dbms/mssqlserver/filesystem.py +++ b/plugins/dbms/mssqlserver/filesystem.py @@ -17,7 +17,6 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import posixToNtSlashes from lib.core.common import randomStr from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapNoneDataException diff --git a/plugins/dbms/mssqlserver/fingerprint.py b/plugins/dbms/mssqlserver/fingerprint.py index 9cb84b111..9f95d28cd 100644 --- a/plugins/dbms/mssqlserver/fingerprint.py +++ b/plugins/dbms/mssqlserver/fingerprint.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.common import getUnicode @@ -19,10 +18,7 @@ from lib.core.enums import DBMS from lib.core.enums import OS from lib.core.session import setDbms from lib.core.settings import MSSQL_ALIASES -from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/mssqlserver/syntax.py b/plugins/dbms/mssqlserver/syntax.py index 3cafc5154..178cee8c9 100644 --- a/plugins/dbms/mssqlserver/syntax.py +++ b/plugins/dbms/mssqlserver/syntax.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapSyntaxException - from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/dbms/mssqlserver/takeover.py b/plugins/dbms/mssqlserver/takeover.py index 7d5e8ced4..c0d4a5d7a 100644 --- a/plugins/dbms/mssqlserver/takeover.py +++ b/plugins/dbms/mssqlserver/takeover.py @@ -10,11 +10,9 @@ See the file 'doc/COPYING' for copying permission import binascii from lib.core.common import Backend -from lib.core.data import kb from lib.core.data import logger from lib.core.exception import sqlmapUnsupportedFeatureException from lib.request import inject - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/mysql/__init__.py b/plugins/dbms/mysql/__init__.py index e14527906..ef60f1676 100644 --- a/plugins/dbms/mysql/__init__.py +++ b/plugins/dbms/mysql/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import MYSQL_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.mysql.enumeration import Enumeration from plugins.dbms.mysql.filesystem import Filesystem from plugins.dbms.mysql.fingerprint import Fingerprint diff --git a/plugins/dbms/mysql/connector.py b/plugins/dbms/mysql/connector.py index 05692e704..c1db444ca 100644 --- a/plugins/dbms/mysql/connector.py +++ b/plugins/dbms/mysql/connector.py @@ -15,7 +15,6 @@ except ImportError, _: from lib.core.data import conf from lib.core.data import logger from lib.core.exception import sqlmapConnectionException - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/mysql/filesystem.py b/plugins/dbms/mysql/filesystem.py index 583db884c..4ffcf3843 100644 --- a/plugins/dbms/mysql/filesystem.py +++ b/plugins/dbms/mysql/filesystem.py @@ -18,7 +18,6 @@ from lib.core.enums import PLACE from lib.core.exception import sqlmapNoneDataException from lib.request import inject from lib.techniques.union.use import unionUse - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/mysql/fingerprint.py b/plugins/dbms/mysql/fingerprint.py index 5c8f8fa61..d4f2591ce 100644 --- a/plugins/dbms/mysql/fingerprint.py +++ b/plugins/dbms/mysql/fingerprint.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import re -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.common import getUnicode @@ -19,13 +18,10 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.enums import DBMS from lib.core.enums import OS -from lib.core.enums import PLACE from lib.core.session import setDbms from lib.core.settings import MYSQL_ALIASES from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/mysql/takeover.py b/plugins/dbms/mysql/takeover.py index ac428e2f1..8d29b0e37 100644 --- a/plugins/dbms/mysql/takeover.py +++ b/plugins/dbms/mysql/takeover.py @@ -22,7 +22,6 @@ from lib.core.enums import OS from lib.core.enums import PAYLOAD from lib.request import inject from lib.request.connect import Connect as Request - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/oracle/__init__.py b/plugins/dbms/oracle/__init__.py index 023a66aae..90d111261 100644 --- a/plugins/dbms/oracle/__init__.py +++ b/plugins/dbms/oracle/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import ORACLE_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.oracle.enumeration import Enumeration from plugins.dbms.oracle.filesystem import Filesystem from plugins.dbms.oracle.fingerprint import Fingerprint diff --git a/plugins/dbms/oracle/connector.py b/plugins/dbms/oracle/connector.py index 9002a90d0..2e534e041 100644 --- a/plugins/dbms/oracle/connector.py +++ b/plugins/dbms/oracle/connector.py @@ -12,15 +12,14 @@ try: except ImportError, _: pass -import os +import os from lib.core.convert import utf8encode from lib.core.data import logger from lib.core.exception import sqlmapConnectionException - from plugins.generic.connector import Connector as GenericConnector -os.environ["NLS_LANG"] = ".AL32UTF8" +os.environ["NLS_LANG"] = ".AL32UTF8" class Connector(GenericConnector): """ diff --git a/plugins/dbms/oracle/enumeration.py b/plugins/dbms/oracle/enumeration.py index 7add219e2..58bbc629c 100644 --- a/plugins/dbms/oracle/enumeration.py +++ b/plugins/dbms/oracle/enumeration.py @@ -7,15 +7,12 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import getLimitRange from lib.core.common import isInferenceAvailable from lib.core.common import isNoneValue from lib.core.common import isNumPosStrValue from lib.core.common import isTechniqueAvailable -from lib.core.common import safeSQLIdentificatorNaming -from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -24,7 +21,6 @@ from lib.core.enums import EXPECTED from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapNoneDataException from lib.request import inject - from plugins.generic.enumeration import Enumeration as GenericEnumeration class Enumeration(GenericEnumeration): diff --git a/plugins/dbms/oracle/filesystem.py b/plugins/dbms/oracle/filesystem.py index f497cac9b..beb22eaf1 100644 --- a/plugins/dbms/oracle/filesystem.py +++ b/plugins/dbms/oracle/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/oracle/fingerprint.py b/plugins/dbms/oracle/fingerprint.py index 390fb99dd..d0126e218 100644 --- a/plugins/dbms/oracle/fingerprint.py +++ b/plugins/dbms/oracle/fingerprint.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission import re -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf @@ -19,8 +18,6 @@ from lib.core.enums import DBMS from lib.core.session import setDbms from lib.core.settings import ORACLE_ALIASES from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/oracle/takeover.py b/plugins/dbms/oracle/takeover.py index 7b5a12486..07758d398 100644 --- a/plugins/dbms/oracle/takeover.py +++ b/plugins/dbms/oracle/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/postgresql/__init__.py b/plugins/dbms/postgresql/__init__.py index 29f13ab4f..379469718 100644 --- a/plugins/dbms/postgresql/__init__.py +++ b/plugins/dbms/postgresql/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import PGSQL_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.postgresql.enumeration import Enumeration from plugins.dbms.postgresql.filesystem import Filesystem from plugins.dbms.postgresql.fingerprint import Fingerprint diff --git a/plugins/dbms/postgresql/connector.py b/plugins/dbms/postgresql/connector.py index b5f99697c..5e9cb5eda 100644 --- a/plugins/dbms/postgresql/connector.py +++ b/plugins/dbms/postgresql/connector.py @@ -17,7 +17,6 @@ except ImportError, _: from lib.core.data import logger from lib.core.exception import sqlmapConnectionException - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/postgresql/enumeration.py b/plugins/dbms/postgresql/enumeration.py index c748d68c0..a8cc6245f 100644 --- a/plugins/dbms/postgresql/enumeration.py +++ b/plugins/dbms/postgresql/enumeration.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.enums import DBMS from plugins.generic.enumeration import Enumeration as GenericEnumeration class Enumeration(GenericEnumeration): diff --git a/plugins/dbms/postgresql/filesystem.py b/plugins/dbms/postgresql/filesystem.py index 304c0ccb5..15c3146fa 100644 --- a/plugins/dbms/postgresql/filesystem.py +++ b/plugins/dbms/postgresql/filesystem.py @@ -14,7 +14,6 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.exception import sqlmapUnsupportedFeatureException from lib.request import inject - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/postgresql/fingerprint.py b/plugins/dbms/postgresql/fingerprint.py index 435c347ac..b07a93a9e 100644 --- a/plugins/dbms/postgresql/fingerprint.py +++ b/plugins/dbms/postgresql/fingerprint.py @@ -7,9 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import re - -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.common import getUnicode @@ -23,8 +20,6 @@ from lib.core.session import setDbms from lib.core.settings import PGSQL_ALIASES from lib.core.settings import PGSQL_SYSTEM_DBS from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/postgresql/takeover.py b/plugins/dbms/postgresql/takeover.py index b6ed83296..34e53fcd2 100644 --- a/plugins/dbms/postgresql/takeover.py +++ b/plugins/dbms/postgresql/takeover.py @@ -15,7 +15,6 @@ from lib.core.data import paths from lib.core.enums import OS from lib.core.exception import sqlmapUnsupportedFeatureException from lib.request import inject - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/sqlite/__init__.py b/plugins/dbms/sqlite/__init__.py index 6eb802f6d..d1a8d6a81 100644 --- a/plugins/dbms/sqlite/__init__.py +++ b/plugins/dbms/sqlite/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import SQLITE_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.sqlite.enumeration import Enumeration from plugins.dbms.sqlite.filesystem import Filesystem from plugins.dbms.sqlite.fingerprint import Fingerprint diff --git a/plugins/dbms/sqlite/connector.py b/plugins/dbms/sqlite/connector.py index 9d1be373d..28f93b4ab 100644 --- a/plugins/dbms/sqlite/connector.py +++ b/plugins/dbms/sqlite/connector.py @@ -17,7 +17,6 @@ from lib.core.data import conf from lib.core.data import logger from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapMissingDependence - from plugins.generic.connector import Connector as GenericConnector diff --git a/plugins/dbms/sqlite/filesystem.py b/plugins/dbms/sqlite/filesystem.py index 5b13cee30..c4af8d991 100644 --- a/plugins/dbms/sqlite/filesystem.py +++ b/plugins/dbms/sqlite/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/sqlite/fingerprint.py b/plugins/dbms/sqlite/fingerprint.py index 07e1c7d5f..d38512814 100644 --- a/plugins/dbms/sqlite/fingerprint.py +++ b/plugins/dbms/sqlite/fingerprint.py @@ -7,7 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf @@ -18,8 +17,6 @@ from lib.core.session import setDbms from lib.core.settings import METADB_SUFFIX from lib.core.settings import SQLITE_ALIASES from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/sqlite/syntax.py b/plugins/dbms/sqlite/syntax.py index fbe297c3e..095f6d8f4 100644 --- a/plugins/dbms/sqlite/syntax.py +++ b/plugins/dbms/sqlite/syntax.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.common import isDBMSVersionAtLeast from lib.core.exception import sqlmapSyntaxException - from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/dbms/sqlite/takeover.py b/plugins/dbms/sqlite/takeover.py index 2c7ba1758..cb90e9b1b 100644 --- a/plugins/dbms/sqlite/takeover.py +++ b/plugins/dbms/sqlite/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/dbms/sybase/__init__.py b/plugins/dbms/sybase/__init__.py index 1c14b061c..dbb72e88f 100644 --- a/plugins/dbms/sybase/__init__.py +++ b/plugins/dbms/sybase/__init__.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.enums import DBMS from lib.core.settings import SYBASE_SYSTEM_DBS from lib.core.unescaper import unescaper - from plugins.dbms.sybase.enumeration import Enumeration from plugins.dbms.sybase.filesystem import Filesystem from plugins.dbms.sybase.fingerprint import Fingerprint diff --git a/plugins/dbms/sybase/connector.py b/plugins/dbms/sybase/connector.py index 5ffc3d855..fc84cab7c 100644 --- a/plugins/dbms/sybase/connector.py +++ b/plugins/dbms/sybase/connector.py @@ -17,7 +17,6 @@ from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.data import logger from lib.core.exception import sqlmapConnectionException - from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): diff --git a/plugins/dbms/sybase/enumeration.py b/plugins/dbms/sybase/enumeration.py index b006142a9..587b00f9b 100644 --- a/plugins/dbms/sybase/enumeration.py +++ b/plugins/dbms/sybase/enumeration.py @@ -12,7 +12,6 @@ from lib.core.common import filterPairValues from lib.core.common import isTechniqueAvailable from lib.core.common import randomStr from lib.core.common import safeSQLIdentificatorNaming -from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming from lib.core.data import conf from lib.core.data import kb diff --git a/plugins/dbms/sybase/filesystem.py b/plugins/dbms/sybase/filesystem.py index 3e32faa8f..417079881 100644 --- a/plugins/dbms/sybase/filesystem.py +++ b/plugins/dbms/sybase/filesystem.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): diff --git a/plugins/dbms/sybase/fingerprint.py b/plugins/dbms/sybase/fingerprint.py index a8182cd11..0a8dccbbc 100644 --- a/plugins/dbms/sybase/fingerprint.py +++ b/plugins/dbms/sybase/fingerprint.py @@ -7,10 +7,8 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import Format -from lib.core.common import randomInt from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -19,8 +17,6 @@ from lib.core.enums import OS from lib.core.session import setDbms from lib.core.settings import SYBASE_ALIASES from lib.request import inject -from lib.request.connect import Connect as Request - from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): diff --git a/plugins/dbms/sybase/syntax.py b/plugins/dbms/sybase/syntax.py index 6b00f868c..5c9d3a517 100644 --- a/plugins/dbms/sybase/syntax.py +++ b/plugins/dbms/sybase/syntax.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapSyntaxException - from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): diff --git a/plugins/dbms/sybase/takeover.py b/plugins/dbms/sybase/takeover.py index b5c82df52..51462d36f 100644 --- a/plugins/dbms/sybase/takeover.py +++ b/plugins/dbms/sybase/takeover.py @@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.exception import sqlmapUnsupportedFeatureException - from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 05e3957d1..a2eea12e8 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -8,8 +8,8 @@ See the file 'doc/COPYING' for copying permission """ import re -import time +from extra.safe2bin.safe2bin import safechardecode from lib.core.agent import agent from lib.core.bigarray import BigArray from lib.core.common import arrayizeValue @@ -18,7 +18,6 @@ from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout from lib.core.common import filterPairValues from lib.core.common import getLimitRange -from lib.core.common import getCompiledRegex from lib.core.common import getUnicode from lib.core.common import isInferenceAvailable from lib.core.common import isNoneValue @@ -30,13 +29,11 @@ from lib.core.common import popValue from lib.core.common import pushValue from lib.core.common import randomStr from lib.core.common import readInput -from lib.core.common import safeStringFormat from lib.core.common import safeSQLIdentificatorNaming from lib.core.common import singleTimeWarnMessage from lib.core.common import strToHex from lib.core.common import unArrayizeValue from lib.core.common import unsafeSQLIdentificatorNaming -from lib.core.convert import safechardecode from lib.core.convert import utf8decode from lib.core.data import conf from lib.core.data import kb @@ -60,15 +57,12 @@ from lib.core.session import setOs from lib.core.settings import CONCAT_ROW_DELIMITER from lib.core.settings import CONCAT_VALUE_DELIMITER from lib.core.settings import CURRENT_DB -from lib.core.settings import DEFAULT_MSSQL_SCHEMA from lib.core.settings import MAX_INT from lib.core.settings import SQL_STATEMENTS from lib.core.shell import autoCompletion -from lib.core.unescaper import unescaper from lib.core.threads import getCurrentThreadData from lib.parse.banner import bannerParser from lib.request import inject -from lib.request.connect import Connect as Request from lib.techniques.brute.use import columnExists from lib.techniques.brute.use import tableExists from lib.utils.hash import attackDumpedTable @@ -499,7 +493,7 @@ class Enumeration: elif Backend.isDbms(DBMS.ORACLE) or ( Backend.isDbms(DBMS.MYSQL) and kb.data.has_information_schema ): privileges.add(privilege) - # In MySQL < 5.0 we get Y if the privilege is + # In MySQL < 5.0 we get Y if the privilege is # True, N otherwise elif Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema: if privilege.upper() == "Y": @@ -522,7 +516,7 @@ class Enumeration: i += 1 - privileges.add(privilege) + privileges.add(privilege) if self.__isAdminFromPrivileges(privileges): areAdmins.add(user) @@ -624,7 +618,7 @@ class Enumeration: elif Backend.isDbms(DBMS.ORACLE) or ( Backend.isDbms(DBMS.MYSQL) and kb.data.has_information_schema ): privileges.add(privilege) - # In MySQL < 5.0 we get Y if the privilege is + # In MySQL < 5.0 we get Y if the privilege is # True, N otherwise elif Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema: privilege = privilege.replace(", ", ",") @@ -1425,7 +1419,7 @@ class Enumeration: raise sqlmapNoneDataException, errMsg if not validPivotValue: - warnMsg = "no proper pivot column provided (with unique values)." + warnMsg = "no proper pivot column provided (with unique values)." warnMsg += " It's not possible to retrieve all rows." logger.warn(warnMsg) diff --git a/plugins/generic/filesystem.py b/plugins/generic/filesystem.py index 568919420..3c9cb6214 100644 --- a/plugins/generic/filesystem.py +++ b/plugins/generic/filesystem.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission import binascii import codecs import os -import re from lib.core.agent import agent from lib.core.common import dataToOutFile @@ -19,12 +18,9 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import randomStr from lib.core.common import readInput from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.enums import DBMS -from lib.core.enums import OS from lib.core.enums import PAYLOAD -from lib.core.exception import sqlmapFilePathException from lib.core.exception import sqlmapUndefinedMethod from lib.request import inject diff --git a/plugins/generic/fingerprint.py b/plugins/generic/fingerprint.py index e883d08b0..70fb61adc 100644 --- a/plugins/generic/fingerprint.py +++ b/plugins/generic/fingerprint.py @@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission from lib.core.common import Backend from lib.core.common import readInput -from lib.core.data import kb from lib.core.data import logger from lib.core.enums import OS from lib.core.exception import sqlmapUndefinedMethod diff --git a/plugins/generic/misc.py b/plugins/generic/misc.py index e46f17ef6..ff7388ee7 100644 --- a/plugins/generic/misc.py +++ b/plugins/generic/misc.py @@ -7,8 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -import re - from lib.core.common import getCompiledRegex from lib.core.common import Backend from lib.core.common import isTechniqueAvailable diff --git a/plugins/generic/takeover.py b/plugins/generic/takeover.py index 78f40a5fb..b40bb0b12 100644 --- a/plugins/generic/takeover.py +++ b/plugins/generic/takeover.py @@ -14,7 +14,6 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import readInput from lib.core.common import runningAsAdmin from lib.core.data import conf -from lib.core.data import kb from lib.core.data import logger from lib.core.enums import DBMS from lib.core.enums import OS diff --git a/tamper/charencode.py b/tamper/charencode.py index 6e57ca309..cf61862b8 100644 --- a/tamper/charencode.py +++ b/tamper/charencode.py @@ -10,7 +10,6 @@ See the file 'doc/COPYING' for copying permission import string from lib.core.enums import PRIORITY -from lib.core.exception import sqlmapUnsupportedFeatureException __priority__ = PRIORITY.LOWEST diff --git a/tamper/space2dash.py b/tamper/space2dash.py index e6826238f..515447a6b 100644 --- a/tamper/space2dash.py +++ b/tamper/space2dash.py @@ -10,8 +10,6 @@ See the file 'doc/COPYING' for copying permission import random import string -from lib.core.common import singleTimeWarnMessage -from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOW diff --git a/tamper/space2mssqlhash.py b/tamper/space2mssqlhash.py index fceff4a1b..55dda46e3 100644 --- a/tamper/space2mssqlhash.py +++ b/tamper/space2mssqlhash.py @@ -7,8 +7,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ -from lib.core.common import singleTimeWarnMessage -from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOW diff --git a/tamper/unmagicquotes.py b/tamper/unmagicquotes.py index 3e89d1863..d79eb60c1 100644 --- a/tamper/unmagicquotes.py +++ b/tamper/unmagicquotes.py @@ -9,8 +9,6 @@ See the file 'doc/COPYING' for copying permission import re -from lib.core.common import singleTimeWarnMessage -from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL