mirror of
https://github.com/MattKeeley/Spoofy.git
synced 2026-02-03 13:33:24 +00:00
fix: threading bug
This commit is contained in:
16
spoofy.py
16
spoofy.py
@@ -45,17 +45,10 @@ def process_domains(domains, output):
|
||||
"""
|
||||
This function is for multithreading woot woot!
|
||||
"""
|
||||
num_threads = os.cpu_count()
|
||||
threads = []
|
||||
num_domains = len(domains)
|
||||
num_threads = min(num_threads, num_domains)
|
||||
|
||||
for i in range(num_threads):
|
||||
start = i * num_domains // num_threads
|
||||
end = (i + 1) * num_domains // num_threads
|
||||
|
||||
thread = threading.Thread(
|
||||
target=process_domains_worker, args=(domains[start:end], output))
|
||||
for domain in domains:
|
||||
thread = threading.Thread(target=process_domain, args=(domain, output))
|
||||
thread.start()
|
||||
threads.append(thread)
|
||||
|
||||
@@ -63,11 +56,6 @@ def process_domains(domains, output):
|
||||
thread.join()
|
||||
|
||||
|
||||
def process_domains_worker(domains, output):
|
||||
for domain in domains:
|
||||
process_domain(domain, output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
|
||||
Reference in New Issue
Block a user