Skip to content

Commit 31571e6

Browse files
committed
minor refactoring
1 parent 9c4a62f commit 31571e6

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

lib/request/inject.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,41 +54,43 @@
5454
from lib.techniques.error.use import errorUse
5555
from lib.techniques.union.use import unionUse
5656

57+
def __goDns(payload, expression):
58+
value = None
59+
60+
if conf.dName and kb.dnsTest is not False:
61+
if kb.dnsTest is None:
62+
dnsTest(payload)
63+
64+
if kb.dnsTest:
65+
value = dnsUse(payload, expression)
66+
67+
return value
68+
5769
def __goInference(payload, expression, charsetType=None, firstChar=None, lastChar=None, dump=False):
5870
start = time.time()
5971
value = None
6072
count = 0
6173

6274
value = __goDns(payload, expression)
6375

64-
if value is None:
65-
timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED))
76+
if value:
77+
return value
6678

67-
if not (timeBasedCompare and kb.dnsTest):
68-
if (conf.eta or conf.threads > 1) and Backend.getIdentifiedDbms() and not timeBasedCompare:
69-
_, length, _ = queryOutputLength(expression, payload)
70-
else:
71-
length = None
79+
timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED))
7280

73-
kb.inferenceMode = True
74-
count, value = bisection(payload, expression, length, charsetType, firstChar, lastChar, dump)
75-
kb.inferenceMode = False
76-
77-
if not kb.bruteMode:
78-
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
79-
logger.debug(debugMsg)
80-
81-
return value
82-
83-
def __goDns(payload, expression):
84-
value = None
81+
if not (timeBasedCompare and kb.dnsTest):
82+
if (conf.eta or conf.threads > 1) and Backend.getIdentifiedDbms() and not timeBasedCompare:
83+
_, length, _ = queryOutputLength(expression, payload)
84+
else:
85+
length = None
8586

86-
if conf.dName and kb.dnsTest is not False:
87-
if kb.dnsTest is None:
88-
dnsTest(payload)
87+
kb.inferenceMode = True
88+
count, value = bisection(payload, expression, length, charsetType, firstChar, lastChar, dump)
89+
kb.inferenceMode = False
8990

90-
if kb.dnsTest:
91-
value = dnsUse(payload, expression)
91+
if not kb.bruteMode:
92+
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
93+
logger.debug(debugMsg)
9294

9395
return value
9496

0 commit comments

Comments
 (0)