From bf5544903b8a6cac090afa43b99cf45200109fb3 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 9 Jan 2013 16:10:26 +0100 Subject: [PATCH] Minor style update --- lib/core/option.py | 9 ++++++++- lib/core/testing.py | 2 +- lib/techniques/blind/inference.py | 2 +- lib/techniques/brute/use.py | 4 ++-- lib/utils/crawler.py | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 8be209236..77347d90b 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -14,6 +14,7 @@ import socket import string import sys import threading +import time import urllib2 import urlparse @@ -580,10 +581,16 @@ def _findPageForms(): page, _ = Request.queryPage(content=True) findPageForms(page, conf.url, True, True) else: - for target in getFileItems(conf.bulkFile): + targets = getFileItems(conf.bulkFile) + for i in xrange(len(targets)): try: + target = targets[i] page, _, _= Request.getPage(url=target.strip(), crawling=True, raise404=False) findPageForms(page, target, False, True) + + if conf.verbose in (1, 2): + status = '%d/%d links visited (%d%%)' % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets))) + dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) except Exception, ex: errMsg = "problem occured while searching for forms at '%s' ('%s')" % (target, ex) logger.error(errMsg) diff --git a/lib/core/testing.py b/lib/core/testing.py index 68c45693e..cf8971c50 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -73,7 +73,7 @@ def smokeTest(): retVal = False count += 1 - status = '%d/%d (%d%s) ' % (count, length, round(100.0*count/length), '%') + status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) clearConsoleLine() diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index cb28c1090..e39cbeac1 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -412,7 +412,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if conf.verbose in (1, 2) and not showEta: _ = count - firstChar output += '_' * (min(length, conf.progressWidth) - len(output)) - status = ' %d/%d (%d%s)' % (_, length, round(100.0 * _ / length), '%') + status = ' %d/%d (%d%%)' % (_, length, round(100.0 * _ / length)) output += status if _ != length else " " * len(status) dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(output))) diff --git a/lib/techniques/brute/use.py b/lib/techniques/brute/use.py index 47a086738..6c450e78d 100644 --- a/lib/techniques/brute/use.py +++ b/lib/techniques/brute/use.py @@ -101,7 +101,7 @@ def tableExists(tableFile, regex=None): dataToStdout(infoMsg, True) if conf.verbose in (1, 2): - status = '%d/%d items (%d%s)' % (threadData.shared.count, threadData.shared.limit, round(100.0*threadData.shared.count/threadData.shared.limit), '%') + status = '%d/%d items (%d%%)' % (threadData.shared.count, threadData.shared.limit, round(100.0 * threadData.shared.count / threadData.shared.limit)) dataToStdout("\r[%s] [INFO] tried %s" % (time.strftime("%X"), status), True) kb.locks.io.release() @@ -192,7 +192,7 @@ def columnExists(columnFile, regex=None): dataToStdout(infoMsg, True) if conf.verbose in (1, 2): - status = '%d/%d items (%d%s)' % (threadData.shared.count, threadData.shared.limit, round(100.0*threadData.shared.count/threadData.shared.limit), '%') + status = '%d/%d items (%d%%)' % (threadData.shared.count, threadData.shared.limit, round(100.0 * threadData.shared.count / threadData.shared.limit)) dataToStdout("\r[%s] [INFO] tried %s" % (time.strftime("%X"), status), True) kb.locks.io.release() diff --git a/lib/utils/crawler.py b/lib/utils/crawler.py index 205faf451..3ddfaa982 100644 --- a/lib/utils/crawler.py +++ b/lib/utils/crawler.py @@ -96,7 +96,7 @@ def crawl(target): if conf.verbose in (1, 2): threadData.shared.count += 1 - status = '%d/%d links visited (%d%s)' % (threadData.shared.count, threadData.shared.length, round(100.0*threadData.shared.count/threadData.shared.length), '%') + status = '%d/%d links visited (%d%%)' % (threadData.shared.count, threadData.shared.length, round(100.0 * threadData.shared.count / threadData.shared.length)) dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) threadData.shared.deeper = set()