Skip to content

Commit 3b5529a

Browse files
committed
Add url printing to Connection Failures and form parsing failure
1 parent 2382d26 commit 3b5529a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/core/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4636,7 +4636,7 @@ def geturl(self):
46364636
return self._url
46374637

46384638
if not content:
4639-
errMsg = "can't parse forms as the page content appears to be blank"
4639+
errMsg = "can't parse forms as the page content appears to be blank for '%s'" % url
46404640
if raise_:
46414641
raise SqlmapGenericException(errMsg)
46424642
else:

lib/request/connect.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Connect(object):
152152
def _getPageProxy(**kwargs):
153153
try:
154154
if (len(inspect.stack()) > sys.getrecursionlimit() // 2): # Note: https://github.com/sqlmapproject/sqlmap/issues/4525
155-
warnMsg = "unable to connect to the target URL"
155+
warnMsg = "unable to connect to the target URL '%s'" % url
156156
raise SqlmapConnectionException(warnMsg)
157157
except (TypeError, UnicodeError):
158158
pass
@@ -794,7 +794,7 @@ class _(dict):
794794
if ignoreTimeout:
795795
return None if not conf.ignoreTimeouts else "", None, None
796796
else:
797-
warnMsg = "unable to connect to the target URL (%d - %s)" % (ex.code, _http_client.responses[ex.code])
797+
warnMsg = "unable to connect to the target URL '%s' (%d - %s)" % (url, ex.code, _http_client.responses[ex.code])
798798
if threadData.retriesCount < conf.retries and not kb.threadException:
799799
warnMsg += ". sqlmap is going to retry the request"
800800
logger.critical(warnMsg)
@@ -825,12 +825,12 @@ class _(dict):
825825
warnMsg = "invalid URL address used (%s)" % repr(url)
826826
raise SqlmapSyntaxException(warnMsg)
827827
elif any(_ in tbMsg for _ in ("forcibly closed", "Connection is already closed", "ConnectionAbortedError")):
828-
warnMsg = "connection was forcibly closed by the target URL"
828+
warnMsg = "connection was forcibly closed by the target URL '%s'" % url
829829
elif "timed out" in tbMsg:
830830
if kb.testMode and kb.testType not in (None, PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED):
831831
singleTimeWarnMessage("there is a possibility that the target (or WAF/IPS) is dropping 'suspicious' requests")
832832
kb.droppingRequests = True
833-
warnMsg = "connection timed out to the target URL"
833+
warnMsg = "connection timed out to the target URL '%s'" % url
834834
elif "Connection reset" in tbMsg:
835835
if not conf.disablePrecon:
836836
singleTimeWarnMessage("turning off pre-connect mechanism because of connection reset(s)")
@@ -839,9 +839,9 @@ class _(dict):
839839
if kb.testMode:
840840
singleTimeWarnMessage("there is a possibility that the target (or WAF/IPS) is resetting 'suspicious' requests")
841841
kb.droppingRequests = True
842-
warnMsg = "connection reset to the target URL"
842+
warnMsg = "connection reset to the target URL '%s'" % url
843843
elif "URLError" in tbMsg or "error" in tbMsg:
844-
warnMsg = "unable to connect to the target URL"
844+
warnMsg = "unable to connect to the target URL '%s'" % url
845845
match = re.search(r"Errno \d+\] ([^>\n]+)", tbMsg)
846846
if match:
847847
warnMsg += " ('%s')" % match.group(1).strip()
@@ -857,7 +857,7 @@ class _(dict):
857857
warnMsg += "header with option '--user-agent' or switch '--random-agent'"
858858
elif "IncompleteRead" in tbMsg:
859859
warnMsg = "there was an incomplete read error while retrieving data "
860-
warnMsg += "from the target URL"
860+
warnMsg += "from the target URL '%s'" % url
861861
elif "Handshake status" in tbMsg:
862862
status = re.search(r"Handshake status ([\d]{3})", tbMsg)
863863
errMsg = "websocket handshake status %s" % status.group(1) if status else "unknown"
@@ -866,7 +866,7 @@ class _(dict):
866866
warnMsg = "problems with response (de)compression"
867867
retrying = True
868868
else:
869-
warnMsg = "unable to connect to the target URL"
869+
warnMsg = "unable to connect to the target URL '%s'" % url
870870

871871
if "BadStatusLine" not in tbMsg and any((conf.proxy, conf.tor)):
872872
warnMsg += " or proxy"

0 commit comments

Comments
 (0)