
Python modules for hackers (md5, base64, sys)
Checking in the infosecaddicts courses, I found this fantastic python code. We often use tools, but, we do not know how these work, so, in this publication we will analyze a python code to decipher passwords that you can edit according to your needs.
Hackers prefer Python because it’s elementary to learn. We will analyze the following code line by line.
In this line of code we import the modules that we will use.
Then we ask what we are receiving, in case the data is incorrect, we show an example of use in the console.
In the next block of code, we save what we receive.
We perform the validation that we can open the file and open it in read mode.
we read a file line by line and create an empty python dictionary
Finally, we will go through the entire archive looking for our hash.
We have already seen the theory, so we go to practice.
wget https://s3.amazonaws.com/infosecaddicts-files/htcrack.py
vi htcrack.pyvi list.txt
hello
goodbye
red
blue
yourname
tim
bob
Add this above contents, save and exit.
$ htpasswd -nd yourname
Enter yourname as the password
$ python htcrack.py joe:aPWqevyejgfsk list.txt
Related courses:
Try Certified Ethical Hacker for FREE!!!
[ihc-select-level]
References you might find helpful:
http://stackoverflow.com/questions/15026536/looping-over-a-some-ips-from-a-file-in-python
https://s3.amazonaws.com/infosecaddicts-files/md5crack.py
http://stackoverflow.com/questions/3583265/compare-result-from-hexdigest-to-a-string