Ethical Hacking

Learn How to Crack a Password With Python Programming

In recent years ethical hacking has gained huge popularity because of its wide applications. It is used by many organizations to prevent their site from hackers. Before discussing ethical hacking first you need to understand what is hacking.

Hacking is the process of performing malicious activities in a device by gaining unauthorized access using the vulnerabilities found in the system. The malicious activities such as deleting a system file or stealing sensitive information. Mostly hacking is performed illegally without taking permission from the user.

Now, will discuss what is ethical hacking. It is the process of finding the vulnerabilities in a system or device by performing various attacks to resolve those vulnerabilities. Ethical hacking is legal and it is performed after taking permission from the user.

In this ethical hacking project, we are going to use python to create a password cracker which uses a dictionary attack to crack passwords.

Passwords are always hashed before storing in the database and the hash is compared for verification purpose.

Read more..

Learn How to Crack a Password With Python Programming project Looking to build projects on Ethical Hacking?:

Ethical Hacking Kit will be shipped to you and you can learn and build using tutorials. You can start for free today!


Project Implementation:

Let’s start coding:

import hashlib

pass_hash = input(“Enter md5 hash:”)

Now we imported the hashlib library and created a variable which takes the input hash. The next step is to import a file which consists of a bunch of words written into it which is going to act as a dictionary file.

You can download the file from Github which contains a bunch of passwords and it is normally used in the dictionary attack.

But we can also do like this to import the file:

wordlist = input(“Filename”:)


Latest projects on Ethical Hacking

Want to develop practical skills on Ethical Hacking? Checkout our latest projects and start learning for free


Here we are going to put the file name and open it using some read permissions.

We are going to use try bock. For that, type the following:

try:

            pass_file = open (wordlist, “r”)

Except:

            print(“No file found”)

            quit()

Let’s write the program to compare the hashes of different words which are found in this file.

for word in pass_file:

            enc_wrd = word.encode(‘utf-8’)

            digest = hashlib.md5(wnc-wrd.strip()).hexdigest()

Now the hash is created the next step is to compare it with all the other sort of hashes.

if digest == pass_hash:

            print(“Password found”)

            print(“password is “ + word)

flag=1

break

If the hash matches with the word it will print the password and breaks the loop. This will happen only if the password is found in the list. So for the other way we need to create a flag which says 1.

if flag == 0:

print(“password/passphrase is not in the list”)

If the flag is still set to 0 after checking the whole list the above line will be printed. Now our code is ready. Save the program and run it.

To run the program open command prompt in the file location and start the program give the hash name and the dictionary file name. Now the program will start comparing the list and displays you the password.

Also, try giving the wrong hash file which will give the output as no password found. This project is for learning purpose only never misuse it.


How to build Ethical Hacking projects Did you know

Skyfi Labs helps students learn practical skills by building real-world projects.

You can enrol with friends and receive kits at your doorstep

You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Get started today!


Kit required to develop Learn How to Crack a Password With Python Programming:
Technologies you will learn by working on Learn How to Crack a Password With Python Programming:
Password cracker using Python Ethical hacking project
Skyfi Labs Last Updated: 2022-05-16





Join 250,000+ students from 36+ countries & develop practical skills by building projects

Get kits shipped in 24 hours. Build using online tutorials.

Subscribe to receive more project ideas

Stay up-to-date and build projects on latest technologies