minor update regarding last commit (cleaner code)

This commit is contained in:
Miroslav Stampar 2011-07-24 20:44:17 +00:00
parent 3a3561fdaa
commit 2033a28ae7
3 changed files with 40 additions and 42 deletions

View File

@ -1334,10 +1334,6 @@ def parseUnionPage(output, expression, partial=False, condition=None, sort=True)
data = BigArray()
if isinstance(output, list):
for entry in output:
data.append(entry[0] if len(entry) == 1 else entry)
else:
outCond1 = ( output.startswith(kb.misc.start) and output.endswith(kb.misc.stop) )
outCond2 = ( output.startswith(DUMP_START_MARKER) and output.endswith(DUMP_STOP_MARKER) )

View File

@ -375,7 +375,7 @@ def __goInband(expression, expected=None, sort=True, resumeValue=True, unpack=Tr
output = None
partial = False
data = []
data = None
if resumeValue:
output = resume(expression, None)
@ -386,7 +386,9 @@ def __goInband(expression, expected=None, sort=True, resumeValue=True, unpack=Tr
if output is None:
output = unionUse(expression, unpack=unpack, dump=dump)
if output:
if isinstance(output, list):
data = output
else:
data = parseUnionPage(output, expression, partial, None, sort)
return data

View File

@ -309,7 +309,7 @@ def unionUse(expression, unpack=True, dump=False):
if all(map(lambda x: x in output, [kb.misc.start, kb.misc.stop])):
items = extractRegexResult(r'%s(?P<result>.*?)%s' % (kb.misc.start, kb.misc.stop), output, re.DOTALL | re.IGNORECASE).split(kb.misc.delimiter)
kb.locks.value.acquire()
threadData.shared.value.append(items)
threadData.shared.value.append(items[0] if len(items) == 1 else items)
kb.locks.value.release()
else:
items = output.replace(kb.misc.start, "").replace(kb.misc.stop, "").split(kb.misc.delimiter)