|
54 | 54 | from lib.techniques.error.use import errorUse |
55 | 55 | from lib.techniques.union.use import unionUse |
56 | 56 |
|
| 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 | + |
57 | 69 | def __goInference(payload, expression, charsetType=None, firstChar=None, lastChar=None, dump=False): |
58 | 70 | start = time.time() |
59 | 71 | value = None |
60 | 72 | count = 0 |
61 | 73 |
|
62 | 74 | value = __goDns(payload, expression) |
63 | 75 |
|
64 | | - if value is None: |
65 | | - timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED)) |
| 76 | + if value: |
| 77 | + return value |
66 | 78 |
|
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)) |
72 | 80 |
|
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 |
85 | 86 |
|
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 |
89 | 90 |
|
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) |
92 | 94 |
|
93 | 95 | return value |
94 | 96 |
|
|
0 commit comments