fix for cpu without 2^n cores
This commit is contained in:
parent
c267c560c0
commit
a7ea96648d
14
main.py
14
main.py
@ -151,18 +151,18 @@ def attack(Bytes=gen_6_bytes()):
|
|||||||
max_upper_limit = 2**16
|
max_upper_limit = 2**16
|
||||||
chunk_size = max_upper_limit // num_cores
|
chunk_size = max_upper_limit // num_cores
|
||||||
|
|
||||||
for i in range(num_cores):
|
for i in range(num_cores-1):
|
||||||
start = i * chunk_size
|
start = i * chunk_size
|
||||||
end = start + chunk_size
|
end = start + chunk_size
|
||||||
process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
|
process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
|
||||||
processes.append(process)
|
processes.append(process)
|
||||||
process.start()
|
process.start()
|
||||||
# # last process
|
# last process
|
||||||
# start = (num_cores-1) * chunk_size
|
start = (num_cores-1) * chunk_size
|
||||||
# end = max_upper_limit
|
end = max_upper_limit
|
||||||
# process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
|
process = multiprocessing.Process(target=attack_worker, args=(start, end, Bytes, result_queue, stop_event))
|
||||||
# processes.append(process)
|
processes.append(process)
|
||||||
# process.start()
|
process.start()
|
||||||
|
|
||||||
for process in processes:
|
for process in processes:
|
||||||
process.join()
|
process.join()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user