@@ -1334,49 +1334,53 @@ def parseUnionPage(output, expression, partial=False, condition=None, sort=True)
13341334
13351335 data = BigArray ()
13361336
1337- outCond1 = ( output .startswith (kb .misc .start ) and output .endswith (kb .misc .stop ) )
1338- outCond2 = ( output .startswith (DUMP_START_MARKER ) and output .endswith (DUMP_STOP_MARKER ) )
1339-
1340- if outCond1 or outCond2 :
1341- if outCond1 :
1342- regExpr = '%s(.*?)%s' % (kb .misc .start , kb .misc .stop )
1343- elif outCond2 :
1344- regExpr = '%s(.*?)%s' % (DUMP_START_MARKER , DUMP_STOP_MARKER )
1345-
1346- output = re .findall (regExpr , output , re .DOTALL | re .IGNORECASE )
1347- if condition is None :
1348- condition = (
1349- kb .resumedQueries and conf .url in kb .resumedQueries .keys ()
1350- and expression in kb .resumedQueries [conf .url ].keys ()
1351- )
1352-
1353- if partial or not condition :
1354- logOutput = "" .join (["%s%s%s" % (DUMP_START_MARKER , replaceNewlineTabs (value ), DUMP_STOP_MARKER ) for value in output ])
1355- dataToSessionFile ("[%s][%s][%s][%s][%s]\n " % (conf .url , kb .injection .place , conf .parameters [kb .injection .place ], expression , logOutput ))
1356-
1357- if sort :
1358- dict_ = {}
1359- for entry in output :
1360- dict_ [entry .lower ()] = entry
1361- output = dict_ .values ()
1362-
1337+ if isinstance (output , list ):
13631338 for entry in output :
1364- info = []
1339+ data .append (entry [0 ] if len (entry ) == 1 else entry )
1340+ else :
1341+ outCond1 = ( output .startswith (kb .misc .start ) and output .endswith (kb .misc .stop ) )
1342+ outCond2 = ( output .startswith (DUMP_START_MARKER ) and output .endswith (DUMP_STOP_MARKER ) )
1343+
1344+ if outCond1 or outCond2 :
1345+ if outCond1 :
1346+ regExpr = '%s(.*?)%s' % (kb .misc .start , kb .misc .stop )
1347+ elif outCond2 :
1348+ regExpr = '%s(.*?)%s' % (DUMP_START_MARKER , DUMP_STOP_MARKER )
1349+
1350+ output = re .findall (regExpr , output , re .DOTALL | re .IGNORECASE )
1351+ if condition is None :
1352+ condition = (
1353+ kb .resumedQueries and conf .url in kb .resumedQueries .keys ()
1354+ and expression in kb .resumedQueries [conf .url ].keys ()
1355+ )
1356+
1357+ if partial or not condition :
1358+ logOutput = "" .join (["%s%s%s" % (DUMP_START_MARKER , replaceNewlineTabs (value ), DUMP_STOP_MARKER ) for value in output ])
1359+ dataToSessionFile ("[%s][%s][%s][%s][%s]\n " % (conf .url , kb .injection .place , conf .parameters [kb .injection .place ], expression , logOutput ))
1360+
1361+ if sort :
1362+ dict_ = {}
1363+ for entry in output :
1364+ dict_ [entry .lower ()] = entry
1365+ output = dict_ .values ()
13651366
1366- if DUMP_DEL_MARKER in entry :
1367- entry = entry .split (DUMP_DEL_MARKER )
1368- else :
1369- entry = entry .split (kb .misc .delimiter )
1367+ for entry in output :
1368+ info = []
13701369
1371- if len (entry ) == 1 :
1372- data .append (entry [0 ])
1373- else :
1374- for value in entry :
1375- info .append (value )
1370+ if DUMP_DEL_MARKER in entry :
1371+ entry = entry .split (DUMP_DEL_MARKER )
1372+ else :
1373+ entry = entry .split (kb .misc .delimiter )
13761374
1377- data .append (info )
1378- else :
1379- data = output
1375+ if len (entry ) == 1 :
1376+ data .append (entry [0 ])
1377+ else :
1378+ for value in entry :
1379+ info .append (value )
1380+
1381+ data .append (info )
1382+ else :
1383+ data = output
13801384
13811385 if len (data ) == 1 and isinstance (data [0 ], basestring ):
13821386 data = data [0 ]
0 commit comments