LEARN CYBER SECURITY

Python for Cyber Security | MD5 hash




MD5 HASH USING PYTHON

This blog post particularly focuses on how to make a md5 password brute forcer using python. Python is a great and an obvious to learn programming language for all hackers and cyber security experts. 
This series will help you get started with Python for developing advance tools in field of Networking, cyber security and Penetration Testing.

 Here's the code.

import md5
import time

counter = 1
md5_hash = raw_input("Please Enter your md5 Hash: ")
pwdfile = raw_input("please enter your wordlist path: ")



try:
    pwdfile = open(pwdfile,"r")
except:
    print "\nFile not found"
    quit()

for password in pwdfile:
    filemd5 = md5.new(password.strip()).hexdigest()
    start = time.time()
    print "Trying passowrd %d: %s" % (counter, password.strip())

    counter += 1
    end = time.time()
    t_time = end - start

    if md5_hash == filemd5:
        print "\nPassword Found. \nPassword is : %s" % password
        print "Total runtime was -- ", t_time, "second"
        time.sleep(10)
        break
       

else:
    print "\nPassword not Found.


Save it somewhere on your PC. Open terminal and run the python file and give it a go.

root@bandit:~/demo# python md5crack.py
Please Enter your md5 Hash: 5f4dcc3b5aa765d61d8327deb882cf99
please enter your wordlist path: /usr/share/wordlists/rockyou.txt 
Trying passowrd 1: 123456
Trying passowrd 2: 12345
Trying passowrd 3: 123456789
Trying passowrd 4: password

Password Found.
Password is : password

Total runtime was --  1.69277191162e-05 second

In this way you can make a basic python script for MD5 has.

Here's the link to youtube tutorial. Click 












Post a Comment

0 Comments