Baby steps (2 to 3 at a time)

This commit is contained in:
Miroslav Stampar
2019-01-22 00:40:48 +01:00
parent 17b79cd21b
commit 7672b9a0a2
36 changed files with 139 additions and 139 deletions

View File

@@ -75,7 +75,7 @@ def action():
if conf.getPasswordHashes:
try:
conf.dumper.userSettings("database management system users password hashes", conf.dbmsHandler.getPasswordHashes(), "password hash", CONTENT_TYPE.PASSWORDS)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise
@@ -83,7 +83,7 @@ def action():
if conf.getPrivileges:
try:
conf.dumper.userSettings("database management system users privileges", conf.dbmsHandler.getPrivileges(), "privilege", CONTENT_TYPE.PRIVILEGES)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise
@@ -91,7 +91,7 @@ def action():
if conf.getRoles:
try:
conf.dumper.userSettings("database management system users roles", conf.dbmsHandler.getRoles(), "role", CONTENT_TYPE.ROLES)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise

View File

@@ -1440,7 +1440,7 @@ def identifyWaf():
try:
logger.debug("checking for WAF/IPS product '%s'" % product)
found = function(_)
except Exception, ex:
except Exception as ex:
errMsg = "exception occurred while running "
errMsg += "WAF script for '%s' ('%s')" % (product, getSafeExString(ex))
logger.critical(errMsg)
@@ -1543,11 +1543,11 @@ def checkConnection(suppressOutput=False):
except socket.gaierror:
errMsg = "host '%s' does not exist" % conf.hostname
raise SqlmapConnectionException(errMsg)
except socket.error, ex:
except socket.error as ex:
errMsg = "problem occurred while "
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
except UnicodeError, ex:
except UnicodeError as ex:
errMsg = "problem occurred while "
errMsg += "handling a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
raise SqlmapDataException(errMsg)
@@ -1591,7 +1591,7 @@ def checkConnection(suppressOutput=False):
port = match.group(1) if match else 443
conf.url = re.sub(r":\d+(/|\Z)", ":%s\g<1>" % port, conf.url)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
if conf.ipv6:
warnMsg = "check connection to a provided "
warnMsg += "IPv6 address with a tool like ping6 "

View File

@@ -257,7 +257,7 @@ def _saveToResultsFile():
conf.resultsFP.write(line)
conf.resultsFP.flush()
except IOError, ex:
except IOError as ex:
errMsg = "unable to write to the results file '%s' ('%s'). " % (conf.resultsFilename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -689,7 +689,7 @@ def start():
except SqlmapSilentQuitException:
raise
except SqlmapBaseException, ex:
except SqlmapBaseException as ex:
errMsg = getSafeExString(ex)
if conf.multipleTargets:

View File

@@ -105,13 +105,13 @@ def setHandler():
if sqlalchemy.connector:
conf.dbmsConnector = sqlalchemy
except Exception, ex:
except Exception as ex:
exception = ex
if not dialect or exception:
try:
conf.dbmsConnector.connect()
except Exception, ex:
except Exception as ex:
if exception:
raise exception
else: