diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 3f570f369..26bd4df93 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -7,6 +7,7 @@ Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/) See the file 'doc/COPYING' for copying permission """ +import httplib import logging import re import socket @@ -972,7 +973,7 @@ def checkConnection(suppressOutput=False): errMsg = getUnicode(errMsg) logger.critical(errMsg) - if any(code in kb.httpErrorCodes for code in (404, )): + if any(code in kb.httpErrorCodes for code in (httplib.NOT_FOUND, )): msg = "it is not recommended to continue in this kind of cases. Do you want to quit and make sure that everything is set up properly? [Y/n] " if readInput(msg, default="Y") not in ("n", "N"): raise sqlmapSilentQuitException diff --git a/lib/request/connect.py b/lib/request/connect.py index 3b87f93e8..a875a892e 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -425,11 +425,11 @@ class Connect: logger.log(7, responseMsg) - if e.code == 401: + if e.code == httplib.UNAUTHORIZED: errMsg = "not authorized, try to provide right HTTP " errMsg += "authentication type and valid credentials (%d)" % code raise sqlmapConnectionException, errMsg - elif e.code == 404: + elif e.code == httplib.NOT_FOUND: if raise404: errMsg = "page not found (%d)" % code raise sqlmapConnectionException, errMsg @@ -437,7 +437,7 @@ class Connect: debugMsg = "page not found (%d)" % code logger.debug(debugMsg) processResponse(page, responseHeaders) - elif e.code == 504: + elif e.code == httplib.GATEWAY_TIMEOUT: if ignoreTimeout: return None, None, None else: