How do I create a brute force password finder using python?
Question:
I want to create a brute force password finder using python for ethical reasons, I looked up tutorials on how to do this and all the tutorials I found have variables that contain the password. I want to find the password but I don’t know what it is.
So what I want for the code to do is to get the password text-box of any website and take passwords from a list I have and try using them in the text box. I am not sure how to do that, but here is some sample code of what I have so far. Also, I am a somewhat beginner when it comes to coding python, I have a somewhat good grasp of the fundamentals of the language. So depending on how you word your response I might not understand what to do.
Code:
import random
char_list = './password.txt'
password = 'lakers'
def main():
with open('./password.txt') as f:
for line in f:
guess_password = random.choices(char_list)
if __name__ == '__main__':
main()
Answers:
So most websites will use a POST request for their logins. Identify the requests attributes and its path. Then use the requests
library to make the same request inside your password cracker. Now onto the Password Cracker part. If you are looking for a numerical password cracker that is a lot easier. For example.
import requests
for i in range(1000000):
requests.post(path, data={"username": username, "password": i})
Now this would still remain efficient, however if you’re cracking an alphanumerical password it would cross the line into completely redundant and useless. It would take 92 years on a pretty decent CPU to crack an 8 character password.
If you still insist on using an alphanumerical password cracker here would be the code
import itertools
import string
chars = string.printable
attempts = 0
for password_length in range(1, 9):
for guess in itertools.product(chars, repeat=password_length):
attempts += 1
# Make a request to the server with the guess as the password
I highly recommend you use Cython to speed up the process. It greatly helps and speeds up by a lot.
I want to create a brute force password finder using python for ethical reasons, I looked up tutorials on how to do this and all the tutorials I found have variables that contain the password. I want to find the password but I don’t know what it is.
So what I want for the code to do is to get the password text-box of any website and take passwords from a list I have and try using them in the text box. I am not sure how to do that, but here is some sample code of what I have so far. Also, I am a somewhat beginner when it comes to coding python, I have a somewhat good grasp of the fundamentals of the language. So depending on how you word your response I might not understand what to do.
Code:
import random
char_list = './password.txt'
password = 'lakers'
def main():
with open('./password.txt') as f:
for line in f:
guess_password = random.choices(char_list)
if __name__ == '__main__':
main()
So most websites will use a POST request for their logins. Identify the requests attributes and its path. Then use the requests
library to make the same request inside your password cracker. Now onto the Password Cracker part. If you are looking for a numerical password cracker that is a lot easier. For example.
import requests
for i in range(1000000):
requests.post(path, data={"username": username, "password": i})
Now this would still remain efficient, however if you’re cracking an alphanumerical password it would cross the line into completely redundant and useless. It would take 92 years on a pretty decent CPU to crack an 8 character password.
If you still insist on using an alphanumerical password cracker here would be the code
import itertools
import string
chars = string.printable
attempts = 0
for password_length in range(1, 9):
for guess in itertools.product(chars, repeat=password_length):
attempts += 1
# Make a request to the server with the guess as the password
I highly recommend you use Cython to speed up the process. It greatly helps and speeds up by a lot.