1919from lib .core .common import extractExpectedValue
2020from lib .core .common import filterNone
2121from lib .core .common import getPublicTypeMembers
22+ from lib .core .common import getTechnique
2223from lib .core .common import getTechniqueData
2324from lib .core .common import hashDBRetrieve
2425from lib .core .common import hashDBWrite
3132from lib .core .common import pushValue
3233from lib .core .common import randomStr
3334from lib .core .common import readInput
35+ from lib .core .common import setTechnique
3436from lib .core .common import singleTimeWarnMessage
3537from lib .core .compat import xrange
3638from lib .core .data import conf
@@ -88,7 +90,7 @@ def _goInference(payload, expression, charsetType=None, firstChar=None, lastChar
8890 if value is not None :
8991 return value
9092
91- timeBasedCompare = (kb . technique in (PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED ))
93+ timeBasedCompare = (getTechnique () in (PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED ))
9294
9395 if timeBasedCompare and conf .threads > 1 and kb .forceThreads is None :
9496 msg = "multi-threading is considered unsafe in "
@@ -160,9 +162,9 @@ def _goInferenceProxy(expression, fromUser=False, batch=False, unpack=True, char
160162 parameter through a bisection algorithm.
161163 """
162164
163- initTechnique (kb . technique )
165+ initTechnique (getTechnique () )
164166
165- query = agent .prefixQuery (kb .injection .data [kb . technique ].vector )
167+ query = agent .prefixQuery (kb .injection .data [getTechnique () ].vector )
166168 query = agent .suffixQuery (query )
167169 payload = agent .payload (newValue = query )
168170 count = None
@@ -307,24 +309,24 @@ def _goBooleanProxy(expression):
307309 Retrieve the output of a boolean based SQL query
308310 """
309311
310- initTechnique (kb . technique )
312+ initTechnique (getTechnique () )
311313
312314 if conf .dnsDomain :
313- query = agent .prefixQuery (kb .injection .data [kb . technique ].vector )
315+ query = agent .prefixQuery (kb .injection .data [getTechnique () ].vector )
314316 query = agent .suffixQuery (query )
315317 payload = agent .payload (newValue = query )
316318 output = _goDns (payload , expression )
317319
318320 if output is not None :
319321 return output
320322
321- vector = kb .injection .data [kb . technique ].vector
323+ vector = kb .injection .data [getTechnique () ].vector
322324 vector = vector .replace (INFERENCE_MARKER , expression )
323325 query = agent .prefixQuery (vector )
324326 query = agent .suffixQuery (query )
325327 payload = agent .payload (newValue = query )
326328
327- timeBasedCompare = kb . technique in (PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED )
329+ timeBasedCompare = getTechnique () in (PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED )
328330
329331 output = hashDBRetrieve (expression , checkConf = True )
330332
@@ -401,7 +403,7 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
401403
402404 if not conf .forceDns :
403405 if union and isTechniqueAvailable (PAYLOAD .TECHNIQUE .UNION ):
404- kb . technique = PAYLOAD .TECHNIQUE .UNION
406+ setTechnique ( PAYLOAD .TECHNIQUE .UNION )
405407 kb .forcePartialUnion = kb .injection .data [PAYLOAD .TECHNIQUE .UNION ].vector [8 ]
406408 fallback = not expected and kb .injection .data [PAYLOAD .TECHNIQUE .UNION ].where == PAYLOAD .WHERE .ORIGINAL and not kb .forcePartialUnion
407409
@@ -433,7 +435,7 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
433435 singleTimeWarnMessage (warnMsg )
434436
435437 if error and any (isTechniqueAvailable (_ ) for _ in (PAYLOAD .TECHNIQUE .ERROR , PAYLOAD .TECHNIQUE .QUERY )) and not found :
436- kb . technique = PAYLOAD .TECHNIQUE .ERROR if isTechniqueAvailable (PAYLOAD .TECHNIQUE .ERROR ) else PAYLOAD .TECHNIQUE .QUERY
438+ setTechnique ( PAYLOAD .TECHNIQUE .ERROR if isTechniqueAvailable (PAYLOAD .TECHNIQUE .ERROR ) else PAYLOAD .TECHNIQUE .QUERY )
437439 value = errorUse (forgeCaseExpression if expected == EXPECTED .BOOL else query , dump )
438440 count += 1
439441 found = (value is not None ) or (value is None and expectingNone ) or count >= MAX_TECHNIQUES_PER_VALUE
@@ -446,7 +448,7 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
446448 singleTimeWarnMessage (warnMsg )
447449
448450 if blind and isTechniqueAvailable (PAYLOAD .TECHNIQUE .BOOLEAN ) and not found :
449- kb . technique = PAYLOAD .TECHNIQUE .BOOLEAN
451+ setTechnique ( PAYLOAD .TECHNIQUE .BOOLEAN )
450452
451453 if expected == EXPECTED .BOOL :
452454 value = _goBooleanProxy (booleanExpression )
@@ -461,9 +463,9 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
461463 kb .responseTimeMode = "%s|%s" % (match .group (1 ), match .group (2 )) if match else None
462464
463465 if isTechniqueAvailable (PAYLOAD .TECHNIQUE .TIME ):
464- kb . technique = PAYLOAD .TECHNIQUE .TIME
466+ setTechnique ( PAYLOAD .TECHNIQUE .TIME )
465467 else :
466- kb . technique = PAYLOAD .TECHNIQUE .STACKED
468+ setTechnique ( PAYLOAD .TECHNIQUE .STACKED )
467469
468470 if expected == EXPECTED .BOOL :
469471 value = _goBooleanProxy (booleanExpression )
@@ -505,12 +507,12 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
505507
506508def goStacked (expression , silent = False ):
507509 if PAYLOAD .TECHNIQUE .STACKED in kb .injection .data :
508- kb . technique = PAYLOAD .TECHNIQUE .STACKED
510+ setTechnique ( PAYLOAD .TECHNIQUE .STACKED )
509511 else :
510512 for technique in getPublicTypeMembers (PAYLOAD .TECHNIQUE , True ):
511513 _ = getTechniqueData (technique )
512514 if _ and "stacked" in _ ["title" ].lower ():
513- kb . technique = technique
515+ setTechnique ( technique )
514516 break
515517
516518 expression = cleanQuery (expression )
0 commit comments