2021年3月20日星期六

Username and password iteration in python 3 [duplicate]

I have been trying to think of a way to iterate through a username list and check each value of password from a password list. For example, there is a list of 2 usernames, admin and root, there is also a password list of 5 passwords.

For each of the usernames all passwords will have to checked.

I have been able to come up with this piece of code:

if os.path.isfile(USER_FILE) and os.path.isfile(PASS_FILE):      with open(USER_FILE, 'r') as user_file, open(PASS_FILE, 'r') as pass_file:          for u in user_file.read().splitlines():              for p in pass_file.read().splitlines():                  print(f"{u}:{p}")  

However, after the first username the scripts stops and the 2nd username is not checked agains all passwords in my list.

The output I am getting from the script is as follows:

./brute.py users.txt passwd.txt  admin:root  admin:admin  admin:toor  admin:123456  admin:000000000  admin:password  

Any suggestion is appreciated..

https://stackoverflow.com/questions/66727906/username-and-password-iteration-in-python-3 March 21, 2021 at 08:56AM

没有评论:

发表评论