Skip to content

Commit

Permalink
终端显示成功个数
Browse files Browse the repository at this point in the history
  • Loading branch information
boy-hack committed Jul 20, 2019
1 parent 39b39e3 commit fb065d4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ w13scan是一款插件化基于流量分析的扫描器,通过编写插件它
* [ ] 主动引擎批量fuzz 时间的优化
* [ ] 一些FUZZ插件的编写
* [ ] 对命令行的支持,控制台的颜色等等
* [ ] 终端进度条显示结果个数
* [x] 终端进度条显示结果个数
* [ ] URL去重算法对时间参数的过滤
1 change: 1 addition & 0 deletions lib/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'.pl',
'.cgi',
'.jsp', '.jhtml', '.jhtm', '.jws',
'.htm', '.html',
'.do', ''
]

Expand Down
15 changes: 6 additions & 9 deletions lib/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from config import THREAD_NUM
from lib.data import logger, KB, Share
from lib.output import out


def exception_handled_function(thread_function, args=()):
Expand All @@ -25,7 +26,6 @@ def exception_handled_function(thread_function, args=()):
def run_threads(num_threads, thread_function, args: tuple = ()):
threads = []


try:
info_msg = "Staring {0} threads".format(num_threads)
logger.info(info_msg)
Expand Down Expand Up @@ -83,10 +83,7 @@ def task_run():
KB["lock"].release()
poc_module = copy.deepcopy(KB["registered"][poc_module_name])

try:
poc_module.execute(request, response)
except:
pass
poc_module.execute(request, response)

KB["lock"].acquire()
KB["finished"] += 1
Expand All @@ -99,11 +96,11 @@ def task_run():


def printProgress():
msg = '%s running | %s remaining | %s scanned in %.2f seconds' % (
KB["running"], KB["task_queue"].qsize(), KB["finished"], time.time() - KB['start_time'])
msg = '%s success | %s remaining | %s scanned in %.2f seconds' % (
out.count(), KB["task_queue"].qsize(), KB["finished"], time.time() - KB['start_time'])

out = '\r' + ' ' * (KB['console_width'][0] - len(msg)) + msg
Share.dataToStdout(out)
_ = '\r' + ' ' * (KB['console_width'][0] - len(msg)) + msg
Share.dataToStdout(_)


def task_push(plugin_type, request, response):
Expand Down
5 changes: 2 additions & 3 deletions lib/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# @Author : w8ay
# @File : output.py

from lib.controller import printProgress
from lib.data import Share, KB
from threading import Lock

from lib.data import Share, KB


class OutPut(object):

Expand Down Expand Up @@ -66,7 +66,6 @@ def success(self, url, plugin='unknown', **kw):
self.log(" ")
index += 1
self.lock.release()
printProgress()

def log(self, msg):
width = KB["console_width"][0]
Expand Down

0 comments on commit fb065d4

Please sign in to comment.