mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
Code cleanup
This commit is contained in:
parent
72f3674844
commit
d00e4a458a
|
@ -174,6 +174,7 @@ def start():
|
||||||
|
|
||||||
if __paramDict:
|
if __paramDict:
|
||||||
conf.paramDict["Cookie"] = __paramDict
|
conf.paramDict["Cookie"] = __paramDict
|
||||||
|
# TODO: consider the following line in __setRequestParams()
|
||||||
__testableParameters = True
|
__testableParameters = True
|
||||||
|
|
||||||
if not kb.injPlace or not kb.injParameter or not kb.injType:
|
if not kb.injPlace or not kb.injParameter or not kb.injType:
|
||||||
|
|
|
@ -68,12 +68,12 @@ def setHandler():
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
dbmsHandler = dbmsEntry()
|
handler = dbmsEntry()
|
||||||
|
|
||||||
if dbmsHandler.checkDbms():
|
if handler.checkDbms():
|
||||||
if not conf.dbms or conf.dbms in dbmsAliases:
|
if not conf.dbms or conf.dbms in dbmsAliases:
|
||||||
kb.dbmsDetected = True
|
kb.dbmsDetected = True
|
||||||
|
|
||||||
return dbmsHandler
|
return handler
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -736,7 +736,7 @@ def getDelayQuery(andCond=False):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
query = queries[kb.dbms].timedelay2 % conf.timeSec
|
query = queries[kb.dbms].timedelay2 % conf.timeSec
|
||||||
elif kb.dbms is "Firebird":
|
elif kb.dbms == "Firebird":
|
||||||
query = queries[kb.dbms].timedelay
|
query = queries[kb.dbms].timedelay
|
||||||
else:
|
else:
|
||||||
query = queries[kb.dbms].timedelay % conf.timeSec
|
query = queries[kb.dbms].timedelay % conf.timeSec
|
||||||
|
@ -744,7 +744,7 @@ def getDelayQuery(andCond=False):
|
||||||
if andCond:
|
if andCond:
|
||||||
if kb.dbms in ( "MySQL", "SQLite" ):
|
if kb.dbms in ( "MySQL", "SQLite" ):
|
||||||
query = query.replace("SELECT ", "")
|
query = query.replace("SELECT ", "")
|
||||||
elif kb.dbms is "Firebird":
|
elif kb.dbms == "Firebird":
|
||||||
query = "(%s)>0" % query
|
query = "(%s)>0" % query
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
@ -914,6 +914,7 @@ def sanitizeAsciiString(string):
|
||||||
|
|
||||||
def decloakToNamedTemporaryFile(filepath, name=None):
|
def decloakToNamedTemporaryFile(filepath, name=None):
|
||||||
retVal = NamedTemporaryFile()
|
retVal = NamedTemporaryFile()
|
||||||
|
|
||||||
def __del__():
|
def __del__():
|
||||||
try:
|
try:
|
||||||
if hasattr(retVal, 'old_name'):
|
if hasattr(retVal, 'old_name'):
|
||||||
|
@ -921,12 +922,15 @@ def decloakToNamedTemporaryFile(filepath, name=None):
|
||||||
retVal.close()
|
retVal.close()
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
retVal.__del__ = __del__
|
retVal.__del__ = __del__
|
||||||
retVal.write(decloak(filepath))
|
retVal.write(decloak(filepath))
|
||||||
retVal.seek(0)
|
retVal.seek(0)
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
retVal.old_name = retVal.name
|
retVal.old_name = retVal.name
|
||||||
retVal.name = name
|
retVal.name = name
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def decloakToMkstemp(filepath, **kwargs):
|
def decloakToMkstemp(filepath, **kwargs):
|
||||||
|
|
|
@ -125,7 +125,7 @@ class Dump:
|
||||||
print
|
print
|
||||||
|
|
||||||
def dbColumns(self, dbColumns, colConsider, dbs):
|
def dbColumns(self, dbColumns, colConsider, dbs):
|
||||||
for column, dbTables in dbColumns.items():
|
for column in dbColumns.keys():
|
||||||
if colConsider == "1":
|
if colConsider == "1":
|
||||||
colConsiderStr = "s like '" + column + "' were"
|
colConsiderStr = "s like '" + column + "' were"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -632,9 +632,9 @@ def __setHTTPAuthentication():
|
||||||
key_file = os.path.expanduser(aCertRegExp.group(1))
|
key_file = os.path.expanduser(aCertRegExp.group(1))
|
||||||
cert_file = os.path.expanduser(aCertRegExp.group(2))
|
cert_file = os.path.expanduser(aCertRegExp.group(2))
|
||||||
|
|
||||||
for file in (key_file, cert_file):
|
for ifile in (key_file, cert_file):
|
||||||
if not os.path.exists(file):
|
if not os.path.exists(ifile):
|
||||||
errMsg = "File '%s' doesn't exist" % file
|
errMsg = "File '%s' does not exist" % ifile
|
||||||
raise sqlmapSyntaxException, errMsg
|
raise sqlmapSyntaxException, errMsg
|
||||||
|
|
||||||
authHandler = HTTPSCertAuthHandler(key_file, cert_file)
|
authHandler = HTTPSCertAuthHandler(key_file, cert_file)
|
||||||
|
|
|
@ -47,7 +47,6 @@ from lib.core.data import paths
|
||||||
from lib.core.exception import sqlmapConnectionException
|
from lib.core.exception import sqlmapConnectionException
|
||||||
from lib.core.exception import sqlmapFilePathException
|
from lib.core.exception import sqlmapFilePathException
|
||||||
from lib.core.settings import MSSQL_VERSIONS_URL
|
from lib.core.settings import MSSQL_VERSIONS_URL
|
||||||
from lib.core.settings import VERSION
|
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
|
|
||||||
def __updateMSSQLXML():
|
def __updateMSSQLXML():
|
||||||
|
|
|
@ -32,7 +32,6 @@ from select import select
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
from subprocess import Popen as execute
|
from subprocess import Popen as execute
|
||||||
|
|
||||||
from lib.core.agent import agent
|
|
||||||
from lib.core.common import dataToStdout
|
from lib.core.common import dataToStdout
|
||||||
from lib.core.common import getLocalIP
|
from lib.core.common import getLocalIP
|
||||||
from lib.core.common import getRemoteIP
|
from lib.core.common import getRemoteIP
|
||||||
|
|
|
@ -26,7 +26,6 @@ import os
|
||||||
|
|
||||||
from lib.core.common import randomStr
|
from lib.core.common import randomStr
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
|
|
||||||
class Registry:
|
class Registry:
|
||||||
|
|
|
@ -139,7 +139,7 @@ class UDF:
|
||||||
errMsg = "udfSetLocalPaths() method must be defined within the plugin"
|
errMsg = "udfSetLocalPaths() method must be defined within the plugin"
|
||||||
raise sqlmapUnsupportedFeatureException(errMsg)
|
raise sqlmapUnsupportedFeatureException(errMsg)
|
||||||
|
|
||||||
def udfCreateFromSharedLib(self):
|
def udfCreateFromSharedLib(self, udf=None, inpRet=None):
|
||||||
errMsg = "udfCreateFromSharedLib() method must be defined within the plugin"
|
errMsg = "udfCreateFromSharedLib() method must be defined within the plugin"
|
||||||
raise sqlmapUnsupportedFeatureException(errMsg)
|
raise sqlmapUnsupportedFeatureException(errMsg)
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class UDF:
|
||||||
|
|
||||||
self.checkDbmsOs()
|
self.checkDbmsOs()
|
||||||
|
|
||||||
if self.isDba() == False:
|
if not self.isDba():
|
||||||
warnMsg = "the functionality requested might not work because "
|
warnMsg = "the functionality requested might not work because "
|
||||||
warnMsg += "the session user is not a database administrator"
|
warnMsg += "the session user is not a database administrator"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
@ -317,7 +317,7 @@ class UDF:
|
||||||
udfList = []
|
udfList = []
|
||||||
msg = "which UDF do you want to call?"
|
msg = "which UDF do you want to call?"
|
||||||
|
|
||||||
for udf, inpRet in self.udfs.items():
|
for udf in self.udfs.keys():
|
||||||
udfList.append(udf)
|
udfList.append(udf)
|
||||||
msg += "\n[%d] %s" % (len(udfList), udf)
|
msg += "\n[%d] %s" % (len(udfList), udf)
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,10 @@ class Google:
|
||||||
line option '-g <google dork>'
|
line option '-g <google dork>'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, proxyHandler):
|
def __init__(self, proxy):
|
||||||
self.__googleCookie = None
|
|
||||||
self.__matches = []
|
self.__matches = []
|
||||||
self.__cj = cookielib.LWPCookieJar()
|
self.__cj = cookielib.LWPCookieJar()
|
||||||
self.opener = urllib2.build_opener(proxyHandler, urllib2.HTTPCookieProcessor(self.__cj))
|
self.opener = urllib2.build_opener(proxy, urllib2.HTTPCookieProcessor(self.__cj))
|
||||||
self.opener.addheaders = conf.httpHeaders
|
self.opener.addheaders = conf.httpHeaders
|
||||||
|
|
||||||
def __parsePage(self, page):
|
def __parsePage(self, page):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user