1818from lib .parse .html import htmlParser
1919from lib .request .connect import Connect as Request
2020
21- def __forgeUserFriendlyValue (payload ):
22- value = ""
23-
24- if kb .injPlace == "GET" :
25- value = "%s?%s" % (conf .url , payload )
26- elif kb .injPlace == "POST" :
27- value = "URL:\t '%s'" % conf .url
28- value += "\n POST:\t '%s'\n " % payload
29- elif kb .injPlace == "Cookie" :
30- value = "URL:\t '%s'" % conf .url
31- value += "\n Cookie:\t '%s'\n " % payload
32- elif kb .injPlace == "User-Agent" :
33- value = "URL:\t \t '%s'" % conf .url
34- value += "\n User-Agent:\t '%s'\n " % payload
35-
36- return value
37-
3821def __unionPosition (negative = False , falseCond = False ):
39- value = None
22+ validPayload = None
4023
4124 if negative or falseCond :
4225 negLogMsg = "partial (single entry)"
@@ -77,56 +60,58 @@ def __unionPosition(negative=False, falseCond=False):
7760
7861 if resultPage and randQuery in resultPage and not htmlParsed :
7962 setUnion (position = exprPosition )
80- value = __forgeUserFriendlyValue ( payload )
63+ validPayload = payload
8164
8265 break
8366
8467 if isinstance (kb .unionPosition , int ):
8568 infoMsg = "the target url is affected by an exploitable "
86- infoMsg += "%s inband sql injection vulnerability" % negLogMsg
69+ infoMsg += "%s inband sql injection vulnerability " % negLogMsg
70+ infoMsg += "on parameter '%s'" % kb .injParameter
8771 logger .info (infoMsg )
8872 else :
8973 warnMsg = "the target url is not affected by an exploitable "
90- warnMsg += "%s inband sql injection vulnerability" % negLogMsg
74+ warnMsg += "%s inband sql injection vulnerability " % negLogMsg
75+ warnMsg += "on parameter '%s'" % kb .injParameter
9176
9277 if negLogMsg == "partial" :
9378 warnMsg += ", sqlmap will retrieve the query output "
9479 warnMsg += "through blind sql injection technique"
9580
9681 logger .warn (warnMsg )
9782
98- return value
83+ return validPayload
9984
10085def __unionConfirm ():
101- value = None
86+ validPayload = None
10287
10388 # Confirm the inband SQL injection and get the exact column
10489 # position
10590 if not isinstance (kb .unionPosition , int ):
106- value = __unionPosition ()
91+ validPayload = __unionPosition ()
10792
10893 # Assure that the above function found the exploitable full inband
10994 # SQL injection position
11095 if not isinstance (kb .unionPosition , int ):
111- value = __unionPosition (negative = True )
96+ validPayload = __unionPosition (negative = True )
11297
11398 # Assure that the above function found the exploitable partial
11499 # (single entry) inband SQL injection position with negative
115- # parameter value
100+ # parameter validPayload
116101 if not isinstance (kb .unionPosition , int ):
117- value = __unionPosition (falseCond = True )
102+ validPayload = __unionPosition (falseCond = True )
118103
119104 # Assure that the above function found the exploitable partial
120105 # (single entry) inband SQL injection position by appending
121- # a false condition after the parameter value
106+ # a false condition after the parameter validPayload
122107 if not isinstance (kb .unionPosition , int ):
123108 return
124109 else :
125110 setUnion (falseCond = True )
126111 else :
127112 setUnion (negative = True )
128113
129- return value
114+ return validPayload
130115
131116def __unionTestByNULLBruteforce (comment ):
132117 """
@@ -200,7 +185,7 @@ def unionTest():
200185 infoMsg += "'%s' with %s technique" % (kb .injParameter , technique )
201186 logger .info (infoMsg )
202187
203- value = None
188+ validPayload = None
204189 columns = None
205190
206191 for comment in (queries [kb .dbms ].comment .query , "" ):
@@ -215,13 +200,13 @@ def unionTest():
215200 break
216201
217202 if kb .unionCount :
218- value = __unionConfirm ()
203+ validPayload = __unionConfirm ()
219204 else :
220205 warnMsg = "the target url is not affected by an "
221206 warnMsg += "inband sql injection vulnerability"
222207 logger .warn (warnMsg )
223208
224- if value is None :
225- value = ""
209+ if validPayload is None :
210+ validPayload = ""
226211
227- return value
212+ return validPayload
0 commit comments