minor refactoring

This commit is contained in:
Bernardo Damele 2012-07-11 11:55:05 +01:00
parent 9c4a62f725
commit 31571e6e2d

View File

@ -54,6 +54,18 @@ from lib.techniques.dns.use import dnsUse
from lib.techniques.error.use import errorUse from lib.techniques.error.use import errorUse
from lib.techniques.union.use import unionUse from lib.techniques.union.use import unionUse
def __goDns(payload, expression):
value = None
if conf.dName and kb.dnsTest is not False:
if kb.dnsTest is None:
dnsTest(payload)
if kb.dnsTest:
value = dnsUse(payload, expression)
return value
def __goInference(payload, expression, charsetType=None, firstChar=None, lastChar=None, dump=False): def __goInference(payload, expression, charsetType=None, firstChar=None, lastChar=None, dump=False):
start = time.time() start = time.time()
value = None value = None
@ -61,7 +73,9 @@ def __goInference(payload, expression, charsetType=None, firstChar=None, lastCha
value = __goDns(payload, expression) value = __goDns(payload, expression)
if value is None: if value:
return value
timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED)) timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED))
if not (timeBasedCompare and kb.dnsTest): if not (timeBasedCompare and kb.dnsTest):
@ -80,18 +94,6 @@ def __goInference(payload, expression, charsetType=None, firstChar=None, lastCha
return value return value
def __goDns(payload, expression):
value = None
if conf.dName and kb.dnsTest is not False:
if kb.dnsTest is None:
dnsTest(payload)
if kb.dnsTest:
value = dnsUse(payload, expression)
return value
def __goInferenceFields(expression, expressionFields, expressionFieldsList, payload, expected=None, num=None, charsetType=None, firstChar=None, lastChar=None, dump=False): def __goInferenceFields(expression, expressionFields, expressionFieldsList, payload, expected=None, num=None, charsetType=None, firstChar=None, lastChar=None, dump=False):
outputs = [] outputs = []
origExpr = None origExpr = None