mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Dealing with deprecated raises
This commit is contained in:
parent
1d9c11b1c1
commit
ae2b02952f
|
@ -90,7 +90,7 @@ class BigArray(list):
|
|||
except IOError, ex:
|
||||
errMsg = "exception occurred while retrieving data "
|
||||
errMsg += "from a temporary file ('%s')" % ex.message
|
||||
raise SqlmapSystemException, errMsg
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
return self.chunks[-1].pop()
|
||||
|
||||
|
@ -115,7 +115,7 @@ class BigArray(list):
|
|||
errMsg += "make sure that there is enough disk space left. If problem persists, "
|
||||
errMsg += "try to set environment variable 'TEMP' to a location "
|
||||
errMsg += "writeable by the current user"
|
||||
raise SqlmapSystemException, errMsg
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
def _checkcache(self, index):
|
||||
if (self.cache and self.cache.index != index and self.cache.dirty):
|
||||
|
@ -129,7 +129,7 @@ class BigArray(list):
|
|||
except IOError, ex:
|
||||
errMsg = "exception occurred while retrieving data "
|
||||
errMsg += "from a temporary file ('%s')" % ex.message
|
||||
raise SqlmapSystemException, errMsg
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
def __getstate__(self):
|
||||
return self.chunks, self.filenames
|
||||
|
|
|
@ -596,9 +596,7 @@ def paramToDict(place, parameters=None):
|
|||
testableParameters[parameter] = "=".join(parts[1:])
|
||||
if not conf.multipleTargets and not (conf.csrfToken and parameter == conf.csrfToken):
|
||||
_ = urldecode(testableParameters[parameter], convall=True)
|
||||
if (_.endswith("'") and _.count("'") == 1
|
||||
or re.search(r'\A9{3,}', _) or re.search(r'\A-\d+\Z', _) or re.search(DUMMY_USER_INJECTION, _))\
|
||||
and not parameter.upper().startswith(GOOGLE_ANALYTICS_COOKIE_PREFIX):
|
||||
if (_.endswith("'") and _.count("'") == 1 or re.search(r'\A9{3,}', _) or re.search(r'\A-\d+\Z', _) or re.search(DUMMY_USER_INJECTION, _)) and not parameter.upper().startswith(GOOGLE_ANALYTICS_COOKIE_PREFIX):
|
||||
warnMsg = "it appears that you have provided tainted parameter values "
|
||||
warnMsg += "('%s') with most likely leftover " % element
|
||||
warnMsg += "chars/statements from manual SQL injection test(s). "
|
||||
|
@ -1371,7 +1369,7 @@ def parseTargetDirect():
|
|||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
if dbmsName in (DBMS.MSSQL, DBMS.SYBASE):
|
||||
import _mssql
|
||||
__import__("_mssql")
|
||||
import pymssql
|
||||
|
||||
if not hasattr(pymssql, "__version__") or pymssql.__version__ < "1.0.2":
|
||||
|
@ -1381,17 +1379,17 @@ def parseTargetDirect():
|
|||
raise SqlmapMissingDependence(errMsg)
|
||||
|
||||
elif dbmsName == DBMS.MYSQL:
|
||||
import pymysql
|
||||
__import__("pymysql")
|
||||
elif dbmsName == DBMS.PGSQL:
|
||||
import psycopg2
|
||||
__import__("psycopg2")
|
||||
elif dbmsName == DBMS.ORACLE:
|
||||
import cx_Oracle
|
||||
__import__("cx_Oracle")
|
||||
elif dbmsName == DBMS.SQLITE:
|
||||
import sqlite3
|
||||
__import__("sqlite3")
|
||||
elif dbmsName == DBMS.ACCESS:
|
||||
import pyodbc
|
||||
__import__("pyodbc")
|
||||
elif dbmsName == DBMS.FIREBIRD:
|
||||
import kinterbasdb
|
||||
__import__("kinterbasdb")
|
||||
except:
|
||||
if _sqlalchemy and data[3] in _sqlalchemy.dialects.__all__:
|
||||
pass
|
||||
|
@ -2005,7 +2003,7 @@ def parseXmlFile(xmlFile, handler):
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
|
||||
def getSQLSnippet(dbms, sfile, **variables):
|
||||
"""
|
||||
|
|
|
@ -80,7 +80,7 @@ def base64unpickle(value, unsafe=False):
|
|||
if len(self.stack) > 1:
|
||||
func = self.stack[-2]
|
||||
if func not in PICKLE_REDUCE_WHITELIST:
|
||||
raise Exception, "abusing reduce() is bad, Mkay!"
|
||||
raise Exception("abusing reduce() is bad, Mkay!")
|
||||
self.load_reduce()
|
||||
|
||||
def loads(str):
|
||||
|
|
|
@ -337,7 +337,7 @@ def _feedTargetsDict(reqFile, addedTargetUrls):
|
|||
|
||||
if not host:
|
||||
errMsg = "invalid format of a request file"
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
if not url.startswith("http"):
|
||||
url = "%s://%s:%s%s" % (scheme or "http", host, port or "80", url)
|
||||
|
@ -402,7 +402,7 @@ def _loadQueries():
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
|
||||
for node in tree.findall("*"):
|
||||
queries[node.attrib['value']] = iterate(node)
|
||||
|
@ -1128,7 +1128,7 @@ def _setHTTPHandlers():
|
|||
_ = urlparse.urlsplit(conf.proxy)
|
||||
except Exception, ex:
|
||||
errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, getSafeExString(ex))
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
hostnamePort = _.netloc.split(":")
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ def _setSafeVisit():
|
|||
kb.safeReq.post = None
|
||||
else:
|
||||
errMsg = "invalid format of a safe request file"
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
else:
|
||||
if not re.search(r"\Ahttp[s]*://", conf.safeUrl):
|
||||
if ":443/" in conf.safeUrl:
|
||||
|
@ -1580,7 +1580,7 @@ def _createTemporaryDirectory():
|
|||
except (OSError, IOError), ex:
|
||||
errMsg = "there has been a problem while accessing "
|
||||
errMsg += "temporary directory location(s) ('%s')" % getSafeExString(ex)
|
||||
raise SqlmapSystemException, errMsg
|
||||
raise SqlmapSystemException(errMsg)
|
||||
else:
|
||||
try:
|
||||
if not os.path.isdir(tempfile.gettempdir()):
|
||||
|
@ -1607,7 +1607,7 @@ def _createTemporaryDirectory():
|
|||
except (OSError, IOError, WindowsError), ex:
|
||||
errMsg = "there has been a problem while setting "
|
||||
errMsg += "temporary directory location ('%s')" % getSafeExString(ex)
|
||||
raise SqlmapSystemException, errMsg
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
def _cleanupOptions():
|
||||
"""
|
||||
|
|
|
@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
|||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.2.3.20"
|
||||
VERSION = "1.2.3.21"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
@ -47,7 +47,7 @@ class Wordlist(object):
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
if len(_.namelist()) == 0:
|
||||
errMsg = "no file(s) inside '%s'" % self.current
|
||||
raise SqlmapDataException(errMsg)
|
||||
|
@ -73,7 +73,7 @@ class Wordlist(object):
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
except StopIteration:
|
||||
self.adjust()
|
||||
retVal = self.iter.next().rstrip()
|
||||
|
|
|
@ -909,7 +909,7 @@ def cmdLineParser(argv=None):
|
|||
for arg in shlex.split(command):
|
||||
argv.append(getUnicode(arg, encoding=sys.stdin.encoding))
|
||||
except ValueError, ex:
|
||||
raise SqlmapSyntaxException, "something went wrong during command line parsing ('%s')" % ex.message
|
||||
raise SqlmapSyntaxException("something went wrong during command line parsing ('%s')" % ex.message)
|
||||
|
||||
for i in xrange(len(argv)):
|
||||
if argv[i] == "-hh":
|
||||
|
|
|
@ -78,7 +78,7 @@ def loadBoundaries():
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (paths.BOUNDARIES_XML, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
|
||||
root = doc.getroot()
|
||||
parseXmlNode(root)
|
||||
|
@ -93,7 +93,7 @@ def loadPayloads():
|
|||
errMsg = "something appears to be wrong with "
|
||||
errMsg += "the file '%s' ('%s'). Please make " % (payloadFilePath, getSafeExString(ex))
|
||||
errMsg += "sure that you haven't made any changes to it"
|
||||
raise SqlmapInstallationException, errMsg
|
||||
raise SqlmapInstallationException(errMsg)
|
||||
|
||||
root = doc.getroot()
|
||||
parseXmlNode(root)
|
||||
|
|
|
@ -32,7 +32,7 @@ def parseSitemap(url, retVal=None):
|
|||
content = Request.getPage(url=url, raise404=True)[0] if not abortedFlag else ""
|
||||
except httplib.InvalidURL:
|
||||
errMsg = "invalid URL given for sitemap ('%s')" % url
|
||||
raise SqlmapSyntaxException, errMsg
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
for match in re.finditer(r"<loc>\s*([^<]+)", content or ""):
|
||||
if abortedFlag:
|
||||
|
|
|
@ -30,10 +30,8 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
|
|||
self.retried_count = 0
|
||||
else:
|
||||
if self.retried_count > 5:
|
||||
raise urllib2.HTTPError(req.get_full_url(), 401, "basic auth failed",
|
||||
headers, None)
|
||||
raise urllib2.HTTPError(req.get_full_url(), 401, "basic auth failed", headers, None)
|
||||
else:
|
||||
self.retried_count += 1
|
||||
|
||||
return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
|
||||
self, auth_header, host, req, headers)
|
||||
return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(self, auth_header, host, req, headers)
|
||||
|
|
|
@ -982,7 +982,7 @@ class Connect(object):
|
|||
if not conf.csrfUrl:
|
||||
errMsg += ". You can try to rerun by providing "
|
||||
errMsg += "a valid value for option '--csrf-url'"
|
||||
raise SqlmapTokenException, errMsg
|
||||
raise SqlmapTokenException(errMsg)
|
||||
|
||||
if token:
|
||||
token = token.strip("'\"")
|
||||
|
|
|
@ -277,7 +277,7 @@ def setRestAPILog():
|
|||
conf.databaseCursor = Database(conf.database)
|
||||
conf.databaseCursor.connect("client")
|
||||
except sqlite3.OperationalError, ex:
|
||||
raise SqlmapConnectionException, "%s ('%s')" % (ex, conf.database)
|
||||
raise SqlmapConnectionException("%s ('%s')" % (ex, conf.database))
|
||||
|
||||
# Set a logging handler that writes log messages to a IPC database
|
||||
logger.removeHandler(LOGGER_HANDLER)
|
||||
|
|
|
@ -92,7 +92,7 @@ class HashDB(object):
|
|||
except sqlite3.DatabaseError, ex:
|
||||
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
|
||||
errMsg += "If the problem persists please rerun with `--flush-session`"
|
||||
raise SqlmapConnectionException, errMsg
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
else:
|
||||
break
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class SQLAlchemy(GenericConnector):
|
|||
try:
|
||||
if not self.port and self.db:
|
||||
if not os.path.exists(self.db):
|
||||
raise SqlmapFilePathException, "the provided database file '%s' does not exist" % self.db
|
||||
raise SqlmapFilePathException("the provided database file '%s' does not exist" % self.db)
|
||||
|
||||
_ = conf.direct.split("//", 1)
|
||||
conf.direct = "%s////%s" % (_[0], os.path.abspath(self.db))
|
||||
|
|
|
@ -26,9 +26,9 @@ e8533a8a406fe58cc610337639ed4bb1 lib/controller/checks.py
|
|||
a7b0c8e5a18a3abe8803999dcfc4664f lib/controller/handler.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
|
||||
052c368ae6ca09362a19376c8483fa85 lib/core/agent.py
|
||||
86a4703d5474badd8462146510b2c460 lib/core/bigarray.py
|
||||
80087ee0716904b24c7970beed20cf27 lib/core/common.py
|
||||
2a40d5b5997265daa890545d4a4a59b9 lib/core/convert.py
|
||||
591c66fa439a48b7d8b5b581437cd14d lib/core/bigarray.py
|
||||
6e41ff058eb86b824215c19a3ae4de3c lib/core/common.py
|
||||
2910524e4478be6b5893fb9d851a62ec lib/core/convert.py
|
||||
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
|
||||
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
|
||||
12e80071013606f01822c3823fb51054 lib/core/decorators.py
|
||||
|
@ -40,13 +40,13 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py
|
|||
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
|
||||
458a194764805cd8312c14ecd4be4d1e lib/core/log.py
|
||||
63ac6631d75e4f7c20b946a0c06bad33 lib/core/optiondict.py
|
||||
a377168b153725d3677924040b7861f4 lib/core/option.py
|
||||
8a9346b975931d8d995354692ab68f82 lib/core/option.py
|
||||
7dadbb9a301d40cc8cd9c7491e99b43d lib/core/profiling.py
|
||||
ffa5f01f39b17c8d73423acca6cfe86a lib/core/readlineng.py
|
||||
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
|
||||
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
|
||||
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
|
||||
8e9da51e9fb8e345f5a8bde0f219b696 lib/core/settings.py
|
||||
aef027eeb51df0bb7330bf35725dba66 lib/core/settings.py
|
||||
d0adc28a38e43a787df4471f7f027413 lib/core/shell.py
|
||||
63491be462c515a1a3880c27c2acc4a2 lib/core/subprocessng.py
|
||||
3cc852f927833895361973fbcfd156d2 lib/core/target.py
|
||||
|
@ -54,21 +54,21 @@ d0adc28a38e43a787df4471f7f027413 lib/core/shell.py
|
|||
de9922a29c71a235cb95a916ff925db2 lib/core/threads.py
|
||||
c40758411bb0bd68764d78e0bb72bd0f lib/core/unescaper.py
|
||||
1b655a78fe4d937d39131938a4a5a1d6 lib/core/update.py
|
||||
fc624104ddb36d41794b7a943fde5f21 lib/core/wordlist.py
|
||||
e772deb63270375e685fa5a7b775c382 lib/core/wordlist.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/__init__.py
|
||||
7620f1f4b8791e13c7184c06b5421754 lib/parse/banner.py
|
||||
27c4d3e568d199e01d1cffd37b370516 lib/parse/cmdline.py
|
||||
d505c725f5d6887ec80b5b94ca1dc9f5 lib/parse/cmdline.py
|
||||
fb2e2f05dde98caeac6ccf3e67192177 lib/parse/configfile.py
|
||||
3794ff139869f5ae8e81cfdbe5714f56 lib/parse/handler.py
|
||||
263ee1cec41facd2a06d0dc887b207ad lib/parse/headers.py
|
||||
33f21b11b7963062df8fa2292229df80 lib/parse/html.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/parse/__init__.py
|
||||
307d4001682f38dd574548d98c0f1c3e lib/parse/payloads.py
|
||||
38563853a32dd677ce6c65a0945d7227 lib/parse/sitemap.py
|
||||
4e60fe7c94bbfa631087ed3426df8ef0 lib/request/basicauthhandler.py
|
||||
ec4e56bbb1349176b2a22e0b99ba6a55 lib/parse/payloads.py
|
||||
492654567e72b6a14584651fcd9f16e6 lib/parse/sitemap.py
|
||||
30eed3a92a04ed2c29770e1b10d39dc0 lib/request/basicauthhandler.py
|
||||
eb39d5cbd69a2238e2f4ea2fde183cdb lib/request/basic.py
|
||||
c0cabedead14b8a23353b606672cff42 lib/request/comparison.py
|
||||
9b31df4b00b1709948e7f0568d69d7de lib/request/connect.py
|
||||
94c0ce8d2a2d9001a416420f61b67ee7 lib/request/connect.py
|
||||
dd4598675027fae99f2e2475b05986da lib/request/direct.py
|
||||
2044fce3f4ffa268fcfaaf63241b1e64 lib/request/dns.py
|
||||
a1436e4e4f9b636cb8332f00b686bfd5 lib/request/httpshandler.py
|
||||
|
@ -98,13 +98,13 @@ b84d45fc7349caa714f9769b13d70cab lib/techniques/blind/inference.py
|
|||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/union/__init__.py
|
||||
da5a117fb64723e6c815b0e33d50f66a lib/techniques/union/test.py
|
||||
ac67ebbabd06bf9853befc65ad49679e lib/techniques/union/use.py
|
||||
e4146464cf968d4015a52cb8c10e3da5 lib/utils/api.py
|
||||
609ba6e5039de4814115b966cd72645a lib/utils/api.py
|
||||
37dfb641358669f62c2acedff241348b lib/utils/brute.py
|
||||
a34c4fd2e7d78c5dfdd9eeccb079fb1c lib/utils/crawler.py
|
||||
69c25da85a3a71a9798804075cdfd62b lib/utils/deps.py
|
||||
a6d6888e14a7c11f0884c8cc18489caa lib/utils/getch.py
|
||||
7af29f61302c8693cd6436d4b69e22d3 lib/utils/har.py
|
||||
9bd8fbfb9c25ee685c97b260331e7165 lib/utils/hashdb.py
|
||||
062e4e8fc43ac54305a75ddd0d482f81 lib/utils/hashdb.py
|
||||
55c552e754b54cd25a47efb84d3e6892 lib/utils/hash.py
|
||||
145120b21fcfca843d5e2c8b0562e4db lib/utils/htmlentities.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/utils/__init__.py
|
||||
|
@ -112,7 +112,7 @@ a6d6888e14a7c11f0884c8cc18489caa lib/utils/getch.py
|
|||
5d6d73d27833eef1b10b9215629533ff lib/utils/progress.py
|
||||
0ec5cec9d93d5ffd1eaeda6e942ecadf lib/utils/purge.py
|
||||
4a6886d3a0c7bf768df97738fa257de9 lib/utils/search.py
|
||||
4b17311256f0081904a67831252e3fb9 lib/utils/sqlalchemy.py
|
||||
236a8d9e596602b53f8e0aa09c30c0ef lib/utils/sqlalchemy.py
|
||||
dcc25183c6bd85b172c87cfcbc305ab6 lib/utils/timeout.py
|
||||
ce5ec6300bc0a185827a21d8a8f09de3 lib/utils/versioncheck.py
|
||||
1e9cf437451ff8147a372a002641b963 lib/utils/xrange.py
|
||||
|
|
Loading…
Reference in New Issue
Block a user