@@ -444,10 +444,7 @@ def genCmpPayload():
444444 configUnion (test .request .char , test .request .columns )
445445
446446 if not Backend .getIdentifiedDbms ():
447- if not kb .heuristicDbms :
448- kb .heuristicDbms = heuristicCheckDbms (injection ) or UNKNOWN_DBMS
449-
450- if kb .heuristicDbms == UNKNOWN_DBMS :
447+ if kb .heuristicDbms in (None , UNKNOWN_DBMS ):
451448 warnMsg = "using unescaped version of the test "
452449 warnMsg += "because of zero knowledge of the "
453450 warnMsg += "back-end DBMS. You can try to "
@@ -552,6 +549,14 @@ def genCmpPayload():
552549 # Reset forced back-end DBMS value
553550 Backend .flushForcedDbms ()
554551
552+ if len (injection .data ) == 1 and PAYLOAD .TECHNIQUE .BOOLEAN in injection .data :
553+ if not Backend .getIdentifiedDbms () and kb .heuristicDbms in (None , UNKNOWN_DBMS ):
554+ kb .heuristicDbms = heuristicCheckDbms (injection ) or UNKNOWN_DBMS
555+
556+ if Backend .getIdentifiedDbms () or kb .heuristicDbms not in (None , UNKNOWN_DBMS ):
557+ #do you want to extend <- one time question!!!!!!!!!! (mirek)
558+ pass
559+
555560 except KeyboardInterrupt :
556561 warnMsg = "user aborted during detection phase"
557562 logger .warn (warnMsg )
@@ -594,21 +599,20 @@ def genCmpPayload():
594599def heuristicCheckDbms (injection ):
595600 retVal = None
596601
597- if not Backend .getIdentifiedDbms () and len (injection .data ) == 1 and PAYLOAD .TECHNIQUE .BOOLEAN in injection .data :
598- pushValue (kb .injection )
599- kb .injection = injection
600- randStr1 , randStr2 = randomStr (), randomStr ()
602+ pushValue (kb .injection )
603+ kb .injection = injection
604+ randStr1 , randStr2 = randomStr (), randomStr ()
601605
602- for dbms in getPublicTypeMembers (DBMS , True ):
603- Backend .forceDbms (dbms )
606+ for dbms in getPublicTypeMembers (DBMS , True ):
607+ Backend .forceDbms (dbms )
604608
605- if checkBooleanExpression ("(SELECT '%s'%s)='%s'" % (randStr1 , FROM_DUMMY_TABLE .get (dbms , "" ), randStr1 )):
606- if not checkBooleanExpression ("(SELECT '%s'%s)='%s'" % (randStr1 , FROM_DUMMY_TABLE .get (dbms , "" ), randStr2 )):
607- retVal = dbms
608- break
609+ if checkBooleanExpression ("(SELECT '%s'%s)='%s'" % (randStr1 , FROM_DUMMY_TABLE .get (dbms , "" ), randStr1 )):
610+ if not checkBooleanExpression ("(SELECT '%s'%s)='%s'" % (randStr1 , FROM_DUMMY_TABLE .get (dbms , "" ), randStr2 )):
611+ retVal = dbms
612+ break
609613
610- Backend .flushForcedDbms ()
611- kb .injection = popValue ()
614+ Backend .flushForcedDbms ()
615+ kb .injection = popValue ()
612616
613617 if retVal :
614618 infoMsg = "heuristic test showed that the back-end DBMS "
0 commit comments