Updated some comments and moved a global variable
This commit is contained in:
@@ -12,8 +12,7 @@ colors = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white",
|
||||
|
||||
total_processes = 0
|
||||
total_decrypt_attempts = 0
|
||||
|
||||
update_rate = 100000
|
||||
update_rate = 0
|
||||
|
||||
"""
|
||||
Get a color for a process using an array
|
||||
@@ -76,9 +75,11 @@ Global function of a child process
|
||||
"""
|
||||
|
||||
|
||||
def worldlist_bruteforce_partial(fileToCrack, wordlistPath, total_proc, processNumbar, startPos, endPos):
|
||||
def worldlist_bruteforce_partial(fileToCrack, wordlistPath, total_proc, rate_of_update, processNumbar, startPos, endPos):
|
||||
global total_processes
|
||||
total_processes = total_proc
|
||||
global update_rate
|
||||
update_rate = rate_of_update
|
||||
|
||||
# Opens the excel file
|
||||
with open(fileToCrack, 'rb') as file:
|
||||
@@ -93,7 +94,9 @@ def worldlist_bruteforce_partial(fileToCrack, wordlistPath, total_proc, processN
|
||||
# Find the right start position in the wordlist for this process
|
||||
print_thread(processNumbar, "Started new process [" + str(startPos) + " -> " + str(endPos) + "]")
|
||||
|
||||
# Sets initial position in the file
|
||||
wordlistToUse.seek(startPos)
|
||||
|
||||
# Move backward until a newline character is found or we reach the beginning of the file
|
||||
position = startPos
|
||||
while position > 0:
|
||||
@@ -109,7 +112,7 @@ def worldlist_bruteforce_partial(fileToCrack, wordlistPath, total_proc, processN
|
||||
try:
|
||||
line = wordlistToUse.readline()
|
||||
|
||||
# End the thread if it has arrived to its given endPos
|
||||
# End the process if it has arrived to its given end position
|
||||
if wordlistToUse.tell() >= endPos:
|
||||
print_thread(processNumbar, "Thread done at line " + line + " with " + str(
|
||||
total_decrypt_attempts) + " attempts.")
|
||||
@@ -125,7 +128,7 @@ def worldlist_bruteforce_partial(fileToCrack, wordlistPath, total_proc, processN
|
||||
|
||||
line = line.rstrip() # Removes line endings
|
||||
|
||||
# Print status every x lines read
|
||||
# Print status every x attempts
|
||||
if last_update <= total_decrypt_attempts - update_rate:
|
||||
calculate_speed(processNumbar, start_time, last_update, line)
|
||||
start_time = time.time()
|
||||
|
||||
Reference in New Issue
Block a user