It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/python
about = \"\"\"
########## ##########
##### _ _ _ #####
##### ___/ |_ __ | || | #####
##### / __| | '_ \| || |_ #####
##### \__ \ | | | |__ _| #####
##### |___/_|_| |_| |_| #####
##### #####
##### MD5 Cracker (Dictionary attack) #####
##### s1n4_c0der[at]yahoo.com #####
########## ##########
\"\"\"
import hashlib, sys
def cracking() :
encrypted = str(sys.argv[0])
count = 0
try :
dict = open(sys.argv[1], \"rb\")
buffer = dict.read().splitlines()
except :
print \"\n\t[-]Sorry, it can't open dictionary file\"
if len(encrypted) == 32 :
out = \"\n\t[+]MD5 --->\"
else :
print \"\n\t[-]Sorry, this is not md5 hash\"
try :
while True :
md5 = hashlib.md5(buffer[count])
if md5.hexdigest().lower() == encrypted.lower() :
cracked = buffer[count]
print \"\n\t\t\tCracked!\n\"
print out, encrypted, \"\n\n\t[+]Cracked --->\", cracked
break
else :
count += 1
except :
print \"\n\t[-]Sorry, it can't crack this hash\"
print about
while True :
cracking()
encrypted = raw_input("\nEnter MD5 encrypted for cracking >> ")
encrypted = str(sys.argv[0])
dict = open("dict.txt", "rb")
dict = open(sys.argv[1], \"rb\")
you've already imported sys, why not use argv statements instead of prompting?
encrypted = raw_input("\nEnter MD5 encrypted for cracking >> ")
replace this line with the following line so they can input the hash from the command line instead of being prompted for it:
encrypted = str(sys.argv[0])
also this line:
dict = open("dict.txt", "rb")
can be replaced with this line:
dict = open(sys.argv[1], \"rb\")
then the usage would look like:
Usage: py md5crack.py hash dictionary
That way the user isn't prompted to input both in separate instances, and they can just put all required info from command line.
if len(sys.argv) != 3:
print(\"Usage: %s <hash> <dictionary file>\" % sys.argv[0])
sys.exit()
md5cracker.py -p hash -d dictionary file
if md5.hexdigest() == encrypted :
...
...
if md5.hexdigest().lower() == encrypted.lower() :
...
...