mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
Baby steps (2 to 3 at a time)
This commit is contained in:
@@ -556,11 +556,11 @@ class Connect(object):
|
||||
if hasattr(conn.fp, '_sock'):
|
||||
conn.fp._sock.close()
|
||||
conn.close()
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
warnMsg = "problem occurred during connection closing ('%s')" % getSafeExString(ex)
|
||||
logger.warn(warnMsg)
|
||||
|
||||
except SqlmapConnectionException, ex:
|
||||
except SqlmapConnectionException as ex:
|
||||
if conf.proxyList and not kb.threadException:
|
||||
warnMsg = "unable to connect to the target URL ('%s')" % ex
|
||||
logger.critical(warnMsg)
|
||||
@@ -569,7 +569,7 @@ class Connect(object):
|
||||
else:
|
||||
raise
|
||||
|
||||
except urllib2.HTTPError, ex:
|
||||
except urllib2.HTTPError as ex:
|
||||
page = None
|
||||
responseHeaders = None
|
||||
|
||||
@@ -834,7 +834,7 @@ class Connect(object):
|
||||
|
||||
try:
|
||||
payload = function(payload=payload, headers=auxHeaders, delimiter=delimiter, hints=hints)
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
errMsg = "error occurred while running tamper "
|
||||
errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex))
|
||||
raise SqlmapGenericException(errMsg)
|
||||
@@ -1097,7 +1097,7 @@ class Connect(object):
|
||||
while True:
|
||||
try:
|
||||
compiler.parse(unicodeencode(conf.evalCode.replace(';', '\n')))
|
||||
except SyntaxError, ex:
|
||||
except SyntaxError as ex:
|
||||
if ex.text:
|
||||
original = replacement = ex.text.strip()
|
||||
if '=' in original:
|
||||
|
||||
@@ -149,7 +149,7 @@ if __name__ == "__main__":
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
except socket.error, ex:
|
||||
except socket.error as ex:
|
||||
if 'Permission' in str(ex):
|
||||
print "[x] Please run with sudo/Administrator privileges"
|
||||
else:
|
||||
|
||||
@@ -63,7 +63,7 @@ class HTTPSConnection(httplib.HTTPSConnection):
|
||||
break
|
||||
else:
|
||||
sock.close()
|
||||
except (ssl.SSLError, socket.error, httplib.BadStatusLine), ex:
|
||||
except (ssl.SSLError, socket.error, httplib.BadStatusLine) as ex:
|
||||
self._tunnel_host = None
|
||||
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
|
||||
|
||||
@@ -83,7 +83,7 @@ class HTTPSConnection(httplib.HTTPSConnection):
|
||||
break
|
||||
else:
|
||||
sock.close()
|
||||
except (ssl.SSLError, socket.error, httplib.BadStatusLine), ex:
|
||||
except (ssl.SSLError, socket.error, httplib.BadStatusLine) as ex:
|
||||
self._tunnel_host = None
|
||||
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class HTTPSPKIAuthHandler(urllib2.HTTPSHandler):
|
||||
try:
|
||||
# Reference: https://docs.python.org/2/library/ssl.html#ssl.SSLContext.load_cert_chain
|
||||
return httplib.HTTPSConnection(host, cert_file=self.auth_file, key_file=self.auth_file, timeout=conf.timeout)
|
||||
except IOError, ex:
|
||||
except IOError as ex:
|
||||
errMsg = "error occurred while using key "
|
||||
errMsg += "file '%s' ('%s')" % (self.auth_file, getSafeExString(ex))
|
||||
raise SqlmapConnectionException(errMsg)
|
||||
|
||||
Reference in New Issue
Block a user