I am trying to improve the performance of this password cracking method:
def search_method_2(num_pass_wheels): global totalguesses result = False starttime = time.time() tests = 0 still_searching = True print("Using method 2 and searching with "+str(num_pass_wheels)+" password wheels.") wheel = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" # we only allow up to 8 wheels for each password for now if (num_pass_wheels > 8): print("Unable to handle the request. No more than 8 characters for a password") still_searching = False # set all of the wheels to the first position pass_wheel_array=array('i',[1,0,0,0,0,0,0,0,0]) while still_searching: ourguess_pass = "" for i in range(0,num_pass_wheels): # once for each wheel if pass_wheel_array[i] > 0: ourguess_pass = wheel[pass_wheel_array[i]] + ourguess_pass #print ("trying ["+ourguess_pass+"]") if (check_userpass(which_password, ourguess_pass)): print ("Success! Password "+str(which_password)+" is " + ourguess_pass) still_searching = False # we can stop now - we found it! result = True #else: #print ("Darn. " + ourguess + " is NOT the password.") tests = tests + 1 totalguesses = totalguesses + 1 carry = 1 for i in range(0,num_pass_wheels): # once for each wheel pass_wheel_array[i] = pass_wheel_array[i] + carry carry = 0 if pass_wheel_array[i] > 62: pass_wheel_array[i] = 1 carry = 1 if i == (num_pass_wheels-1): still_searching = False seconds = time.time()-starttime report_search_time(tests, seconds) return result
This is a modified version of the Science Buddies password cracker (found here: http://www.sciencebuddies.org/science-fair-projects/project_ideas/CompSci_p046.shtml#materials
You can see the full file here if you would like to: https://files.fm/u/bg9ppx77
Basically, I need a way to run this method faster, I can currently do about 200,000 tests (or runs of this method) per second. I would like to double or triple that number so that I can "crack" longer passwords in a reasonable period of time.
If anyone could point me in the right direction that would be great, if anyone has any code ideas that would be amazing.