mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 21:21:33 +00:00
removing of unused imports together with some general code refactoring
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s*(?P<result>.+?)<br\s*/?\s*>",
|
||||
r"<li>Error Type:<br>(?P<result>.+?)</li>",
|
||||
ERROR_PARSING_REGEXES = (
|
||||
r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s*(?P<result>.+?)<br\s*/?\s*>",
|
||||
r"<li>Error Type:<br>(?P<result>.+?)</li>",
|
||||
r"error '[0-9a-f]{8}'((<[^>]+>)|\s)+(?P<result>[^<>]+)"
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import doctest
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user