Incredibly fast crawler designed for OSINT.
Update flash.py
Somdev Sangwan5c61efdb1ace
diff --git a/core/flash.py b/core/flash.pyindex 967dac6..ce06309 100644--- a/core/flash.py+++ b/core/flash.py@@ -1,14 +1,8 @@from __future__ import print_function-import sys-import threading+import concurrent.futuresfrom core.colors import info-try:- import concurrent.futures-except ImportError:- pass-def threader(function, *urls):"""Start multiple threads for a function."""@@ -33,23 +27,11 @@ def flash(function, links, thread_count):"""Process the URLs and uses a threadpool to execute a function."""# Convert links (set) to listlinks = list(links)- if sys.version_info < (3, 2):- for begin in range(0, len(links), thread_count): # Range with step- end = begin + thread_count- splitted = links[begin:end]- threader(function, splitted)- progress = end- if progress > len(links): # Fix if overflow- progress = len(links)- print('\r%s Progress: %i/%i' % (info, progress, len(links)),- end='\r')- sys.stdout.flush()- else:- threadpool = concurrent.futures.ThreadPoolExecutor(+ threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=thread_count)- futures = (threadpool.submit(function, link) for link in links)- for i, _ in enumerate(concurrent.futures.as_completed(futures)):- if i + 1 == len(links) or (i + 1) % thread_count == 0:- print('%s Progress: %i/%i' % (info, i + 1, len(links)),- end='\r')+ futures = (threadpool.submit(function, link) for link in links)+ for i, _ in enumerate(concurrent.futures.as_completed(futures)):+ if i + 1 == len(links) or (i + 1) % thread_count == 0:+ print('%s Progress: %i/%i' % (info, i + 1, len(links)),+ end='\r')print('')