From c968b438f271e8b8084de706a07ed514c3236219 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 6 Jan 2011 09:48:04 +0000 Subject: [PATCH] Ctrl+C added to union dump --- lib/techniques/inband/union/use.py | 48 +++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/lib/techniques/inband/union/use.py b/lib/techniques/inband/union/use.py index d4320f49b..9687b3d82 100644 --- a/lib/techniques/inband/union/use.py +++ b/lib/techniques/inband/union/use.py @@ -172,31 +172,39 @@ def unionUse(expression, direct=False, unescape=True, resetCounter=False, nullCh return - for num in xrange(startLimit, stopLimit): - if kb.dbms in (DBMS.MSSQL, DBMS.SYBASE): - field = expressionFieldsList[0] - elif kb.dbms == DBMS.ORACLE: - field = expressionFieldsList - else: - field = None + try: + for num in xrange(startLimit, stopLimit): + if kb.dbms in (DBMS.MSSQL, DBMS.SYBASE): + field = expressionFieldsList[0] + elif kb.dbms == DBMS.ORACLE: + field = expressionFieldsList + else: + field = None - limitedExpr = agent.limitQuery(num, expression, field) - output = resume(limitedExpr, None) + limitedExpr = agent.limitQuery(num, expression, field) + output = resume(limitedExpr, None) - if not output: - output = unionUse(limitedExpr, direct=True, unescape=False) + if not output: + output = unionUse(limitedExpr, direct=True, unescape=False) - if output: - value += output - parseUnionPage(output, limitedExpr) + if output: + value += output + parseUnionPage(output, limitedExpr) - if conf.verbose in (1, 2): - length = stopLimit - startLimit - count = num - startLimit + 1 - status = '%d/%d entries (%d%s)' % (count, length, round(100.0*count/length), '%') - dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), status), True) + if conf.verbose in (1, 2): + length = stopLimit - startLimit + count = num - startLimit + 1 + status = '%d/%d entries (%d%s)' % (count, length, round(100.0*count/length), '%') + dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), status), True) + + except KeyboardInterrupt: + print + warnMsg = "Ctrl+C detected in dumping phase" + logger.warn(warnMsg) + + finally: + clearConsoleLine(True) - clearConsoleLine(True) return value value = unionUse(expression, direct=True, unescape=False)