mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 20:51:31 +00:00
Doing some more style updating (capitalization of exception classes; using _ is enough for private members - __ is used in Python specific methods)
This commit is contained in:
@@ -67,14 +67,14 @@ from lib.core.enums import PLACE
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.enums import REFLECTIVE_COUNTER
|
||||
from lib.core.enums import SORT_ORDER
|
||||
from lib.core.exception import sqlmapDataException
|
||||
from lib.core.exception import sqlmapFilePathException
|
||||
from lib.core.exception import sqlmapGenericException
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
from lib.core.exception import sqlmapMissingDependence
|
||||
from lib.core.exception import sqlmapSilentQuitException
|
||||
from lib.core.exception import sqlmapSyntaxException
|
||||
from lib.core.exception import sqlmapUserQuitException
|
||||
from lib.core.exception import SqlmapDataException
|
||||
from lib.core.exception import SqlmapFilePathException
|
||||
from lib.core.exception import SqlmapGenericException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
from lib.core.exception import SqlmapMissingDependence
|
||||
from lib.core.exception import SqlmapSilentQuitException
|
||||
from lib.core.exception import SqlmapSyntaxException
|
||||
from lib.core.exception import SqlmapUserQuitException
|
||||
from lib.core.log import LOGGER_HANDLER
|
||||
from lib.core.optiondict import optDict
|
||||
from lib.core.settings import BOLD_PATTERNS
|
||||
@@ -539,7 +539,7 @@ def paramToDict(place, parameters=None):
|
||||
message = "Are you sure you want to continue? [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
if test[0] not in ("y", "Y"):
|
||||
raise sqlmapSilentQuitException
|
||||
raise SqlmapSilentQuitException
|
||||
|
||||
if conf.testParameter and not testableParameters:
|
||||
paramStr = ", ".join(test for test in conf.testParameter)
|
||||
@@ -806,7 +806,7 @@ def readInput(message, default=None, checkBatch=True):
|
||||
except:
|
||||
time.sleep(0.05) # Reference: http://www.gossamer-threads.com/lists/python/python/781893
|
||||
kb.prependFlag = True
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
finally:
|
||||
logging._releaseLock()
|
||||
|
||||
@@ -853,7 +853,7 @@ def checkFile(filename):
|
||||
"""
|
||||
|
||||
if not os.path.isfile(filename):
|
||||
raise sqlmapFilePathException, "unable to read file '%s'" % filename
|
||||
raise SqlmapFilePathException, "unable to read file '%s'" % filename
|
||||
|
||||
def banner():
|
||||
"""
|
||||
@@ -989,7 +989,7 @@ def parseTargetDirect():
|
||||
errMsg = "invalid target details, valid syntax is for instance "
|
||||
errMsg += "'mysql://USER:PASSWORD@DBMS_IP:DBMS_PORT/DATABASE_NAME' "
|
||||
errMsg += "or 'access://DATABASE_FILEPATH'"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
for dbmsName, data in DBMS_DICT.items():
|
||||
if conf.dbms in data[0]:
|
||||
@@ -1004,7 +1004,7 @@ def parseTargetDirect():
|
||||
conf.port = 0
|
||||
elif not remote:
|
||||
errMsg = "missing remote connection details"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
if dbmsName in (DBMS.MSSQL, DBMS.SYBASE):
|
||||
import _mssql
|
||||
@@ -1014,7 +1014,7 @@ def parseTargetDirect():
|
||||
errMsg = "'%s' third-party library must be " % data[1]
|
||||
errMsg += "version >= 1.0.2 to work properly. "
|
||||
errMsg += "Download from '%s'" % data[2]
|
||||
raise sqlmapMissingDependence, errMsg
|
||||
raise SqlmapMissingDependence, errMsg
|
||||
|
||||
elif dbmsName == DBMS.MYSQL:
|
||||
import pymysql
|
||||
@@ -1032,7 +1032,7 @@ def parseTargetDirect():
|
||||
errMsg = "sqlmap requires '%s' third-party library " % data[1]
|
||||
errMsg += "in order to directly connect to the database "
|
||||
errMsg += "%s. Download from '%s'" % (dbmsName, data[2])
|
||||
raise sqlmapMissingDependence, errMsg
|
||||
raise SqlmapMissingDependence, errMsg
|
||||
|
||||
def parseTargetUrl():
|
||||
"""
|
||||
@@ -1047,7 +1047,7 @@ def parseTargetUrl():
|
||||
if re.search("\[.+\]", conf.url) and not socket.has_ipv6:
|
||||
errMsg = "IPv6 addressing is not supported "
|
||||
errMsg += "on this platform"
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
|
||||
if not re.search("^http[s]*://", conf.url, re.I):
|
||||
if ":443/" in conf.url:
|
||||
@@ -1075,14 +1075,14 @@ def parseTargetUrl():
|
||||
|
||||
if any((_ is None, re.search(r'\s', conf.hostname), '..' in conf.hostname, conf.hostname.startswith('.'))):
|
||||
errMsg = "invalid target url"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
if len(hostnamePort) == 2:
|
||||
try:
|
||||
conf.port = int(hostnamePort[1])
|
||||
except:
|
||||
errMsg = "invalid target url"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
elif conf.scheme == "https":
|
||||
conf.port = 443
|
||||
else:
|
||||
@@ -1351,7 +1351,7 @@ def safeStringFormat(format_, params):
|
||||
if count < len(params):
|
||||
retVal = retVal[:index] + getUnicode(params[count]) + retVal[index + 2:]
|
||||
else:
|
||||
raise sqlmapNoneDataException, "wrong number of parameters during string formatting"
|
||||
raise SqlmapNoneDataException, "wrong number of parameters during string formatting"
|
||||
count += 1
|
||||
|
||||
return retVal
|
||||
@@ -2420,11 +2420,11 @@ def initTechnique(technique=None):
|
||||
warnMsg += "'%s'" % enumValueToNameLookup(PAYLOAD.TECHNIQUE, technique)
|
||||
logger.warn(warnMsg)
|
||||
|
||||
except sqlmapDataException:
|
||||
except SqlmapDataException:
|
||||
errMsg = "missing data in old session file(s). "
|
||||
errMsg += "Please use '--flush-session' to deal "
|
||||
errMsg += "with this error"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
def arrayizeValue(value):
|
||||
"""
|
||||
@@ -2543,7 +2543,7 @@ def openFile(filename, mode='r'):
|
||||
errMsg += "Please check %s permissions on a file " % ("write" if \
|
||||
mode and ('w' in mode or 'a' in mode or '+' in mode) else "read")
|
||||
errMsg += "and that it's not locked by another process."
|
||||
raise sqlmapFilePathException, errMsg
|
||||
raise SqlmapFilePathException, errMsg
|
||||
|
||||
def decodeIntToUnicode(value):
|
||||
"""
|
||||
@@ -2857,7 +2857,7 @@ def expandMnemonics(mnemonics, parser, args):
|
||||
|
||||
if pointer in (None, head):
|
||||
errMsg = "mnemonic '%s' can't be resolved to any parameter name" % name
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
elif len(pointer.current) > 1:
|
||||
options = {}
|
||||
@@ -2896,7 +2896,7 @@ def expandMnemonics(mnemonics, parser, args):
|
||||
setattr(args, found.dest, True)
|
||||
else:
|
||||
errMsg = "mnemonic '%s' requires value of type '%s'" % (name, found.type)
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
def safeCSValue(value):
|
||||
"""
|
||||
@@ -3044,7 +3044,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
|
||||
if not content:
|
||||
errMsg = "can't parse forms as the page content appears to be blank"
|
||||
if raise_:
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
else:
|
||||
logger.debug(errMsg)
|
||||
|
||||
@@ -3064,7 +3064,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
|
||||
except ParseError:
|
||||
errMsg = "no success"
|
||||
if raise_:
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
else:
|
||||
logger.debug(errMsg)
|
||||
|
||||
@@ -3085,7 +3085,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
|
||||
errMsg = "there has been a problem while "
|
||||
errMsg += "processing page forms ('%s')" % ex
|
||||
if raise_:
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
else:
|
||||
logger.debug(errMsg)
|
||||
else:
|
||||
@@ -3104,7 +3104,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
|
||||
else:
|
||||
errMsg = "there were no forms found at the given target url"
|
||||
if raise_:
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
else:
|
||||
logger.debug(errMsg)
|
||||
|
||||
@@ -3152,7 +3152,7 @@ def checkDeprecatedOptions(args):
|
||||
errMsg = "switch/option '%s' is deprecated" % _
|
||||
if _ in DEPRECATED_HINTS:
|
||||
errMsg += " (hint: %s)" % DEPRECATED_HINTS[_]
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
|
||||
def evaluateCode(code, variables=None):
|
||||
"""
|
||||
@@ -3165,7 +3165,7 @@ def evaluateCode(code, variables=None):
|
||||
raise
|
||||
except Exception, ex:
|
||||
errMsg = "an error occured while evaluating provided code ('%s'). " % ex
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
|
||||
def serializeObject(object_):
|
||||
"""
|
||||
@@ -3304,7 +3304,7 @@ def resetCookieJar(cookieJar):
|
||||
except cookielib.LoadError, msg:
|
||||
errMsg = "there was a problem loading "
|
||||
errMsg += "cookies file ('%s')" % msg
|
||||
raise sqlmapGenericException, errMsg
|
||||
raise SqlmapGenericException, errMsg
|
||||
|
||||
def prioritySortColumns(columns):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user