@@ -71,19 +71,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
7171 payload = agent .payload (place , parameter , value , "%s%s%s AND %s%d=%d %s" % (value , prefix , ")" * parenthesis , "(" * parenthesis , randInt , randInt , postfix ))
7272 trueResult = Request .queryPage (payload , place )
7373
74- if trueResult == kb . defaultResult :
74+ if trueResult == True :
7575 payload = agent .payload (place , parameter , value , "%s%s%s AND %s%d=%d %s" % (value , prefix , ")" * parenthesis , "(" * parenthesis , randInt , randInt + 1 , postfix ))
7676 falseResult = Request .queryPage (payload , place )
7777
78- if falseResult != kb . defaultResult :
78+ if falseResult != True :
7979 infoMsg = "confirming custom injection "
8080 infoMsg += "on %s parameter '%s'" % (place , parameter )
8181 logger .info (infoMsg )
8282
8383 payload = agent .payload (place , parameter , value , "%s%s%s AND %s%s %s" % (value , prefix , ")" * parenthesis , "(" * parenthesis , randStr , postfix ))
8484 falseResult = Request .queryPage (payload , place )
8585
86- if falseResult != kb . defaultResult :
86+ if falseResult != True :
8787 infoMsg = "%s parameter '%s' is " % (place , parameter )
8888 infoMsg += "custom injectable "
8989 logger .info (infoMsg )
@@ -97,19 +97,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
9797 payload = agent .payload (place , parameter , value , "%s%s AND %s%d=%d" % (value , ")" * parenthesis , "(" * parenthesis , randInt , randInt ))
9898 trueResult = Request .queryPage (payload , place )
9999
100- if trueResult == kb . defaultResult :
100+ if trueResult == True :
101101 payload = agent .payload (place , parameter , value , "%s%s AND %s%d=%d" % (value , ")" * parenthesis , "(" * parenthesis , randInt , randInt + 1 ))
102102 falseResult = Request .queryPage (payload , place )
103103
104- if falseResult != kb . defaultResult :
104+ if falseResult != True :
105105 infoMsg = "confirming unescaped numeric injection "
106106 infoMsg += "on %s parameter '%s'" % (place , parameter )
107107 logger .info (infoMsg )
108108
109109 payload = agent .payload (place , parameter , value , "%s%s AND %s%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr ))
110110 falseResult = Request .queryPage (payload , place )
111111
112- if falseResult != kb . defaultResult :
112+ if falseResult != True :
113113 infoMsg = "%s parameter '%s' is " % (place , parameter )
114114 infoMsg += "unescaped numeric injectable "
115115 infoMsg += "with %d parenthesis" % parenthesis
@@ -128,19 +128,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
128128 payload = agent .payload (place , parameter , value , "%s'%s AND %s'%s'='%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr ))
129129 trueResult = Request .queryPage (payload , place )
130130
131- if trueResult == kb . defaultResult :
131+ if trueResult == True :
132132 payload = agent .payload (place , parameter , value , "%s'%s AND %s'%s'='%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr + randomStr (1 )))
133133 falseResult = Request .queryPage (payload , place )
134134
135- if falseResult != kb . defaultResult :
135+ if falseResult != True :
136136 infoMsg = "confirming single quoted string injection "
137137 infoMsg += "on %s parameter '%s'" % (place , parameter )
138138 logger .info (infoMsg )
139139
140140 payload = agent .payload (place , parameter , value , "%s'%s and %s%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr ))
141141 falseResult = Request .queryPage (payload , place )
142142
143- if falseResult != kb . defaultResult :
143+ if falseResult != True :
144144 infoMsg = "%s parameter '%s' is " % (place , parameter )
145145 infoMsg += "single quoted string injectable "
146146 infoMsg += "with %d parenthesis" % parenthesis
@@ -159,19 +159,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
159159 payload = agent .payload (place , parameter , value , "%s'%s AND %s'%s' LIKE '%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr ))
160160 trueResult = Request .queryPage (payload , place )
161161
162- if trueResult == kb . defaultResult :
162+ if trueResult == True :
163163 payload = agent .payload (place , parameter , value , "%s'%s AND %s'%s' LIKE '%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr + randomStr (1 )))
164164 falseResult = Request .queryPage (payload , place )
165165
166- if falseResult != kb . defaultResult :
166+ if falseResult != True :
167167 infoMsg = "confirming LIKE single quoted string injection "
168168 infoMsg += "on %s parameter '%s'" % (place , parameter )
169169 logger .info (infoMsg )
170170
171171 payload = agent .payload (place , parameter , value , "%s'%s and %s%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr ))
172172 falseResult = Request .queryPage (payload , place )
173173
174- if falseResult != kb . defaultResult :
174+ if falseResult != True :
175175 infoMsg = "%s parameter '%s' is " % (place , parameter )
176176 infoMsg += "LIKE single quoted string injectable "
177177 infoMsg += "with %d parenthesis" % parenthesis
@@ -190,19 +190,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
190190 payload = agent .payload (place , parameter , value , "%s\" %s AND %s\" %s\" =\" %s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr ))
191191 trueResult = Request .queryPage (payload , place )
192192
193- if trueResult == kb . defaultResult :
193+ if trueResult == True :
194194 payload = agent .payload (place , parameter , value , "%s\" %s AND %s\" %s\" =\" %s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr + randomStr (1 )))
195195 falseResult = Request .queryPage (payload , place )
196196
197- if falseResult != kb . defaultResult :
197+ if falseResult != True :
198198 infoMsg = "confirming double quoted string injection "
199199 infoMsg += "on %s parameter '%s'" % (place , parameter )
200200 logger .info (infoMsg )
201201
202202 payload = agent .payload (place , parameter , value , "%s\" %s AND %s%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr ))
203203 falseResult = Request .queryPage (payload , place )
204204
205- if falseResult != kb . defaultResult :
205+ if falseResult != True :
206206 infoMsg = "%s parameter '%s' is " % (place , parameter )
207207 infoMsg += "double quoted string injectable "
208208 infoMsg += "with %d parenthesis" % parenthesis
@@ -221,19 +221,19 @@ def checkSqlInjection(place, parameter, value, parenthesis):
221221 payload = agent .payload (place , parameter , value , "%s\" %s AND %s\" %s\" LIKE \" %s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr ))
222222 trueResult = Request .queryPage (payload , place )
223223
224- if trueResult == kb . defaultResult :
224+ if trueResult == True :
225225 payload = agent .payload (place , parameter , value , "%s\" %s AND %s\" %s\" LIKE \" %s" % (value , ")" * parenthesis , "(" * parenthesis , randStr , randStr + randomStr (1 )))
226226 falseResult = Request .queryPage (payload , place )
227227
228- if falseResult != kb . defaultResult :
228+ if falseResult != True :
229229 infoMsg = "confirming LIKE double quoted string injection "
230230 infoMsg += "on %s parameter '%s'" % (place , parameter )
231231 logger .info (infoMsg )
232232
233233 payload = agent .payload (place , parameter , value , "%s\" %s and %s%s" % (value , ")" * parenthesis , "(" * parenthesis , randStr ))
234234 falseResult = Request .queryPage (payload , place )
235235
236- if falseResult != kb . defaultResult :
236+ if falseResult != True :
237237 infoMsg = "%s parameter '%s' is " % (place , parameter )
238238 infoMsg += "LIKE double quoted string injectable "
239239 infoMsg += "with %d parenthesis" % parenthesis
@@ -262,7 +262,7 @@ def checkDynParam(place, parameter, value):
262262 payload = agent .payload (place , parameter , value , str (randInt ))
263263 dynResult1 = Request .queryPage (payload , place )
264264
265- if kb . defaultResult == dynResult1 :
265+ if True == dynResult1 :
266266 return False
267267
268268 infoMsg = "confirming that %s parameter '%s' is dynamic" % (place , parameter )
@@ -274,8 +274,8 @@ def checkDynParam(place, parameter, value):
274274 payload = agent .payload (place , parameter , value , "\" %s" % randomStr ())
275275 dynResult3 = Request .queryPage (payload , place )
276276
277- condition = kb . defaultResult != dynResult2
278- condition |= kb . defaultResult != dynResult3
277+ condition = True != dynResult2
278+ condition |= True != dynResult3
279279
280280 return condition
281281
@@ -306,52 +306,12 @@ def checkStability():
306306 condition &= secondPage == thirdPage
307307
308308 if condition == False :
309- # Prepare for the comparison algorithm based on page length value
310- pageLengths = []
311- requestsPages = ( firstPage , secondPage , thirdPage )
312-
313- for requestPages in requestsPages :
314- pageLengths .append (len (str (requestPages )))
315-
316- if pageLengths :
317- conf .pageLengths = ( min (pageLengths ) - ( ( min (pageLengths ) * 2 ) / 100 ),
318- max (pageLengths ) + ( ( max (pageLengths ) * 2 ) / 100 ) )
319-
320- if conf .pageLengths [0 ] < conf .pageLengths [1 ]:
321- warnMsg = "url is not stable, sqlmap inspected the page "
322- warnMsg += "and identified that page length can be used "
323- warnMsg += "in the comparison algorithm"
324- logger .warn (warnMsg )
325-
326- kb .defaultResult = True
327-
328- return True
329-
330- # Prepare for the comparison algorithm based on page content's
331- # stable lines subset
332- counter = 0
333- firstLines = firstPage .split ("\n " )
334- secondLines = secondPage .split ("\n " )
335- thirdLines = thirdPage .split ("\n " )
336-
337- for firstLine in firstLines :
338- if counter > len (secondLines ) or counter > len (thirdLines ):
339- break
340-
341- if firstLine in secondLines and firstLine in thirdLines :
342- conf .equalLines .append (firstLine )
343-
344- counter += 1
345-
346- if conf .equalLines :
347- warnMsg = "url is not stable, sqlmap inspected the page "
348- warnMsg += "content and identified a stable lines subset "
349- warnMsg += "to be used in the comparison algorithm"
350- logger .warn (warnMsg )
351-
352- kb .defaultResult = True
353-
354- return True
309+ warnMsg = "url is not stable, sqlmap will base the page "
310+ warnMsg += "comparison on a sequence matcher, if no dynamic nor "
311+ warnMsg += "injectable parameters are detected, refer to user's "
312+ warnMsg += "manual paragraph 'Page comparison' and provide a "
313+ warnMsg += "string or regular expression to match on"
314+ logger .warn (warnMsg )
355315
356316 if condition == True :
357317 logMsg = "url is stable"
@@ -428,7 +388,8 @@ def checkConnection():
428388 logger .info (infoMsg )
429389
430390 try :
431- kb .defaultResult = Request .queryPage ()
391+ page , _ = Request .getPage ()
392+ conf .seqMatcher .set_seq1 (page )
432393 except sqlmapConnectionException , exceptionMsg :
433394 if conf .multipleTargets :
434395 exceptionMsg += ", skipping to next url"
0 commit comments