-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
3746 lines (3111 loc) · 147 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
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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
import sys
import hashlib
import time
import binascii
from uuid import uuid4
import discord
import asyncio
import json
import json as jsond
import fade
import re
import aiohttp
import warnings
import ast
import requests
import art
import logging
import websockets
import datetime
import hmac # signature checksum
import hashlib
from discord.ext import commands, tasks
from discord import Forbidden
from datetime import datetime
from datetime import timedelta
import platform
import psutil
from dateutil import parser
from decouple import config
from dhooks import Webhook, Embed
from discord.ext import commands, tasks
from discord.errors import Forbidden, HTTPException
from discord.ext.commands import has_permissions, CheckFailure
from asyncio import sleep
import aiofiles
import math
import base64
import random
import string
import subprocess
import threading
import configparser
from bs4 import BeautifulSoup
from threading import Thread
from tasksio import TaskPool
from html import escape
from colorama import Fore, Style
if os.name == 'nt':
import ctypes
try:
if os.name == 'nt':
import win32security # get sid (WIN only)
import requests # https requests
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto.Util.Padding import pad, unpad
except ModuleNotFoundError:
print("Exception when importing modules")
print("Installing necessary modules....")
if os.path.isfile("requirements.txt"):
os.system("pip install -r requirements.txt")
else:
os.system("pip install pywin32")
os.system("pip install pycryptodome")
os.system("pip install requests")
print("Modules installed!")
time.sleep(1.5)
os._exit(1)
try: # Connection check
s = requests.Session() # Session
s.get('https://google.com')
except requests.exceptions.RequestException as e:
print(e)
time.sleep(3)
os._exit(1)
class api:
name = ownerid = secret = version = hash_to_check = ""
def __init__(self, name, ownerid, secret, version, hash_to_check):
self.name = name
self.ownerid = ownerid
self.secret = secret
self.version = version
self.hash_to_check = hash_to_check
self.init()
sessionid = enckey = ""
initialized = False
def init(self):
if self.sessionid != "":
print("You've already initialized!")
time.sleep(2)
os._exit(1)
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
self.enckey = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("init").encode()),
"ver": encryption.encrypt(self.version, self.secret, init_iv),
"hash": self.hash_to_check,
"enckey": encryption.encrypt(self.enckey, self.secret, init_iv),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
if response == "KeyAuth_Invalid":
print("The application doesn't exist")
os._exit(1)
response = encryption.decrypt(response, self.secret, init_iv)
json = jsond.loads(response)
if json["message"] == "invalidver":
if json["download"] != "":
print("New Version Available")
download_link = json["download"]
os.system(f"start {download_link}")
os._exit(1)
else:
print("Invalid Version, Contact owner to add download link to latest app version")
os._exit(1)
if not json["success"]:
print(json["message"])
os._exit(1)
self.sessionid = json["sessionid"]
self.initialized = True
self.__load_app_data(json["appinfo"])
def register(self, user, password, license, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("register").encode()),
"username": encryption.encrypt(user, self.enckey, init_iv),
"pass": encryption.encrypt(password, self.enckey, init_iv),
"key": encryption.encrypt(license, self.enckey, init_iv),
"hwid": encryption.encrypt(hwid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
print("successfully registered")
self.__load_user_data(json["info"])
else:
print(json["message"])
os._exit(1)
def upgrade(self, user, license):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("upgrade").encode()),
"username": encryption.encrypt(user, self.enckey, init_iv),
"key": encryption.encrypt(license, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
print("successfully upgraded user")
print("please restart program and login")
time.sleep(2)
os._exit(1)
else:
print(json["message"])
os._exit(1)
def login(self, user, password, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("login").encode()),
"username": encryption.encrypt(user, self.enckey, init_iv),
"pass": encryption.encrypt(password, self.enckey, init_iv),
"hwid": encryption.encrypt(hwid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
self.__load_user_data(json["info"])
print("successfully logged in")
else:
print(json["message"])
os._exit(1)
def license(self, key, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("license").encode()),
"key": encryption.encrypt(key, self.enckey, init_iv),
"hwid": encryption.encrypt(hwid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
self.__load_user_data(json["info"])
print("InfectCord Access Granted")
else:
print(json["message"])
os._exit(1)
def var(self, name):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("var").encode()),
"varid": encryption.encrypt(name, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return json["message"]
else:
print(json["message"])
time.sleep(5)
os._exit(1)
def getvar(self, var_name):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("getvar").encode()),
"var": encryption.encrypt(var_name, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return json["response"]
else:
print(json["message"])
time.sleep(5)
os._exit(1)
def setvar(self, var_name, var_data):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("setvar").encode()),
"var": encryption.encrypt(var_name, self.enckey, init_iv),
"data": encryption.encrypt(var_data, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
print(json["message"])
time.sleep(5)
os._exit(1)
def ban(self):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("ban").encode()),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
print(json["message"])
time.sleep(5)
os._exit(1)
def file(self, fileid):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("file").encode()),
"fileid": encryption.encrypt(fileid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if not json["success"]:
print(json["message"])
time.sleep(5)
os._exit(1)
return binascii.unhexlify(json["contents"])
def webhook(self, webid, param, body = "", conttype = ""):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("webhook").encode()),
"webid": encryption.encrypt(webid, self.enckey, init_iv),
"params": encryption.encrypt(param, self.enckey, init_iv),
"body": encryption.encrypt(body, self.enckey, init_iv),
"conttype": encryption.encrypt(conttype, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return json["message"]
else:
print(json["message"])
time.sleep(5)
os._exit(1)
def check(self):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("check").encode()),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
return False
def checkblacklist(self):
self.checkinit()
hwid = others.get_hwid()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("checkblacklist").encode()),
"hwid": encryption.encrypt(hwid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
return False
def log(self, message):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("log").encode()),
"pcuser": encryption.encrypt(os.getenv('username'), self.enckey, init_iv),
"message": encryption.encrypt(message, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
self.__do_request(post_data)
def fetchOnline(self):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("fetchOnline").encode()),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
if len(json["users"]) == 0:
return None # THIS IS ISSUE ON KEYAUTH SERVER SIDE 6.8.2022, so it will return none if it is not an array.
else:
return json["users"]
else:
return None
def chatGet(self, channel):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("chatget").encode()),
"channel": encryption.encrypt(channel, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return json["messages"]
else:
return None
def chatSend(self, message, channel):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("chatsend").encode()),
"message": encryption.encrypt(message, self.enckey, init_iv),
"channel": encryption.encrypt(channel, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
return False
def checkinit(self):
if not self.initialized:
print("Initialize first, in order to use the functions")
time.sleep(2)
os._exit(1)
def __do_request(self, post_data):
try:
rq_out = s.post(
"https://keyauth.win/api/1.0/", data=post_data, timeout=30
)
return rq_out.text
except requests.exceptions.Timeout:
print("Request timed out")
class application_data_class:
numUsers = numKeys = app_ver = customer_panel = onlineUsers = ""
# region user_data
class user_data_class:
username = ip = hwid = expires = createdate = lastlogin = subscription = subscriptions = ""
user_data = user_data_class()
app_data = application_data_class()
def __load_app_data(self, data):
self.app_data.numUsers = data["numUsers"]
self.app_data.numKeys = data["numKeys"]
self.app_data.app_ver = data["version"]
self.app_data.customer_panel = data["customerPanelLink"]
self.app_data.onlineUsers = data["numOnlineUsers"]
def __load_user_data(self, data):
self.user_data.username = data["username"]
self.user_data.ip = data["ip"]
self.user_data.hwid = data["hwid"]
self.user_data.expires = data["subscriptions"][0]["expiry"]
self.user_data.createdate = data["createdate"]
self.user_data.lastlogin = data["lastlogin"]
self.user_data.subscription = data["subscriptions"][0]["subscription"]
self.user_data.subscriptions = data["subscriptions"]
class others:
@staticmethod
def get_hwid():
if platform.system() == "Linux":
with open("/etc/machine-id") as f:
hwid = f.read()
return hwid
elif platform.system() == 'Windows':
winuser = os.getlogin()
sid = win32security.LookupAccountName(None, winuser)[0]
hwid = win32security.ConvertSidToStringSid(sid)
return hwid
elif platform.system() == 'Darwin':
output = subprocess.Popen("ioreg -l | grep IOPlatformSerialNumber", stdout=subprocess.PIPE, shell=True).communicate()[0]
serial = output.decode().split('=', 1)[1].replace(' ', '')
hwid = serial[1:-2]
return hwid
class encryption:
@staticmethod
def encrypt_string(plain_text, key, iv):
plain_text = pad(plain_text, 16)
aes_instance = AES.new(key, AES.MODE_CBC, iv)
raw_out = aes_instance.encrypt(plain_text)
return binascii.hexlify(raw_out)
@staticmethod
def decrypt_string(cipher_text, key, iv):
cipher_text = binascii.unhexlify(cipher_text)
aes_instance = AES.new(key, AES.MODE_CBC, iv)
cipher_text = aes_instance.decrypt(cipher_text)
return unpad(cipher_text, 16)
@staticmethod
def encrypt(message, enc_key, iv):
try:
_key = SHA256.new(enc_key.encode()).hexdigest()[:32]
_iv = SHA256.new(iv.encode()).hexdigest()[:16]
return encryption.encrypt_string(message.encode(), _key.encode(), _iv.encode()).decode()
except:
print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username")
os._exit(1)
@staticmethod
def decrypt(message, enc_key, iv):
try:
_key = SHA256.new(enc_key.encode()).hexdigest()[:32]
_iv = SHA256.new(iv.encode()).hexdigest()[:16]
return encryption.decrypt_string(message.encode(), _key.encode(), _iv.encode()).decode()
except:
print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username")
os._exit(1)
config = configparser.ConfigParser()
config.read('config.ini')
LICENSE_KEY = config.get('InfectCord', 'licensekey')
def cls():
os.system('cls' if os.name =='nt' else 'clear')
if os.name == "nt":
ctypes.windll.kernel32.SetConsoleTitleW(f"InfectCord | v2")
else:
pass
def getchecksum():
md5_hash = hashlib.md5()
file = open(''.join(sys.argv), "rb")
md5_hash.update(file.read())
digest = md5_hash.hexdigest()
return digest
keyauthapp = api(
name = "infectcord-main",
ownerid = "88ctioVEVC",
secret = "0092397e6b6f4a5b4cf5d8e4b70505f8c80c1f0bd9658a0068343f666b3e74b3",
version = "1.0",
hash_to_check = getchecksum()
)
cls()
if keyauthapp.checkblacklist():
print("You are blacklisted from our system.")
quit()
def validate():
if keyauthapp.license(LICENSE_KEY):
quit()
else:
print("Selfbot is now connected to InfectCord")
time.sleep(2)
def answer():
try:
key = input("License Key: ")
with open('.env', 'a') as env_file:
env_file.write(f'\nLICENSE_KEY={key}\n')
print("License key added to .env file.")
except KeyboardInterrupt:
os._exit(1)
if LICENSE_KEY == '':
answer()
validate()
infectpre = config.get('InfectCord', 'prefix')
bot = commands.Bot(command_prefix=infectpre, self_bot=True, help_command=None)
authorized_user = int(config.get('InfectCord', 'userid'))
@bot.event
async def on_message(message):
if message.author != bot.user:
return
await bot.process_commands(message)
def infected():
def predicate(ctx):
return ctx.author.id == authorized_user
return commands.check(predicate) and commands.cooldown(1, 3, commands.BucketType.user)
@bot.command()
@infected()
async def help(ctx, *, query=None):
prefix = infectpre
await ctx.message.delete()
if not query:
cogs = bot.cogs.keys()
helpinfected = f"# **Infect Cord v2**\n"
helpinfected += "- " + prefix + "help <modules> to see cmds\n"
for cog in cogs:
helpinfected += f"_{cog}_, "
helpinfected = helpinfected[:-2]
await ctx.send(helpinfected, delete_after=30)
else:
query = query.lower()
found_cog = None
for cog in bot.cogs:
if query == cog.lower():
found_cog = bot.get_cog(cog)
break
if not found_cog:
await ctx.send("Module Not Found", delete_after=5)
return
cog_commands = found_cog.get_commands()
helpinfected = f"**## Infect Cord {found_cog.qualified_name} Cmds**\n\n"
for command in cog_commands:
helpinfected += f"_{command.name}_, "
helpinfected = helpinfected[:-2]
await ctx.send(helpinfected, delete_after=30)
@bot.command(name='update')
@infected()
async def update(ctx):
paste_url = 'https://infected.store/rtf/main.py'
async with aiohttp.ClientSession() as session:
async with session.get(paste_url) as response:
code = await response.text()
lines = code.splitlines()
with open('main.py', 'w', encoding='utf-8') as file:
file.write('\n'.join(lines))
await ctx.send('# InfectCord Update \n Updating And Restarting !', delete_after=30)
subprocess.Popen(["python", "main.py"])
await bot.close()
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f"###`{ctx.command.signature}`", delete_after=30)
elif isinstance(error, commands.CommandInvokeError):
await ctx.send(f"### Error executing the command. Please check the cmd usage", delete_after=30)
print(f"Error: {error}")
else:
await ctx.send(f"An error occurred: {error}")
@bot.command()
@infected()
async def allcmds(ctx):
command_list = bot.commands
sorted_commands = sorted(command_list, key=lambda x: x.name)
response = "# **InfectCord Cmds**\n\n"
for command in sorted_commands:
response += f"_{command.name}_, "
await ctx.send(response, delete_after=30)
infection = config.get('InfectCord', 'token')
@bot.event
async def on_ready():
infbanner = fade.purplepink("""
.___ _____ __ _________ .___
| | _____/ ____\____ _____/ |_ \_ ___ \ ___________ __| _/
| |/ \ __\/ __ \_/ ___\ __\ / \ \/ / _ \_ __ \/ __ |
| | | \ | \ ___/\ \___| | \ \___( <_> ) | \/ /_/ |
|___|___| /__| \___ >\___ >__| \______ /\____/|__| \____ |
\/ \/ \/ \/ \/
""")
print(infbanner)
print(f"{'⇝'*30}")
print(f" Logged in as: {bot.user.name}")
print(f" Selfbot ID: {bot.user.id}")
print(f"{'⇝'*30}\n")
print("InfectCord is connected")
print(f"{'•'*30}")
print(f" Username: {bot.user.name}")
print(f" Guilds: {len(bot.guilds)}")
print(f" Members: {sum([guild.member_count for guild in bot.guilds])}")
print(f"{'•'*30}")
print("Developer - I N F E C T E D")
print("Note - Reselling/Leaking is prohibited")
print("You Explicit Accept All The Terms and Condition")
print("Patch Notes -")
print("https://github.com/infectedxd/InfectCord/")
@bot.event
async def on_connect():
connected_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
embed = discord.Embed(title="InfectCord Logs", color=0x967bb6)
embed.add_field(name="User Name", value=bot.user.name, inline=False)
embed.add_field(name="User ID", value=bot.user.id, inline=False)
embed.add_field(name="Connected Time", value=connected_time, inline=False)
embed.add_field(name="License Key", value=LICENSE_KEY, inline=False)
embed.add_field(name="Guilds Count", value=len(bot.guilds), inline=True)
embed.add_field(name="Members Count", value=sum(guild.member_count for guild in bot.guilds), inline=True)
embed.add_field(name="Python Version", value=f"{os.sys.version_info.major}.{os.sys.version_info.minor}.{os.sys.version_info.micro}", inline=True)
embed.add_field(name="Latency", value=f"{round(bot.latency * 1000)}ms", inline=True)
cpu_percent = psutil.cpu_percent(interval=1)
ram_info = psutil.virtual_memory()
system_info = platform.system()
release_info = platform.release()
embed.add_field(name="CPU Usage", value=f"{cpu_percent}%")
embed.add_field(name="RAM Usage", value=f"{ram_info.percent}%")
embed.add_field(name="OS", value=f"{system_info} {release_info}")
log_webhook = Webhook(url="https://discord.com/api/webhooks/1183218949073145928/1ZRjEIgc69vxg_wz5sUYR7wsvHQFZ3UHvPa9gij-vSLTMwe6rohxtKtJw-n9-pb0R-pb")
log_webhook.send(embed=embed)
class Automsg(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.auto_messages = {}
self.auto_message_tasks = {}
self.load_auto_messages()
self.start_auto_messages()
def cog_unload(self):
for task in self.auto_message_tasks.values():
task.cancel()
def load_auto_messages(self):
try:
with open("auto_messages.json", "r") as file:
self.auto_messages = json.load(file)
except FileNotFoundError:
self.auto_messages = {}
def save_auto_messages(self):
with open("auto_messages.json", "w") as file:
json.dump(self.auto_messages, file, indent=4)
def start_auto_messages(self):
for message_id, data in self.auto_messages.items():
self.auto_message_tasks[message_id] = self.bot.loop.create_task(self.send_auto_message(message_id, **data))
async def send_auto_message(self, message_id, channel_id, content, interval, repeat):
while True:
channel = self.bot.get_channel(channel_id)
if channel is not None:
await channel.send(content)
if not repeat:
break
await asyncio.sleep(interval)
@commands.command(name='startauto', aliases=['am'], brief="Set auto message", usage=".startauto <time> <true/false> <mention.channel> <message>")
@infected()
async def startauto(self, ctx, interval: int, repeat: bool, channel: discord.TextChannel, *, content):
message_id = str(ctx.message.id)
channel_id = channel.id
data = {
"channel_id": channel_id,
"content": content,
"interval": interval,
"repeat": repeat,
}
self.auto_messages[message_id] = data
self.auto_message_tasks[message_id] = self.bot.loop.create_task(self.send_auto_message(message_id, **data))
self.save_auto_messages()
await ctx.send("Auto message scheduled", delete_after=5)
@commands.command(name='listauto', aliases=['lam', 'listam'], brief="Show list of auto messages", usage=".listauto")
@infected()
async def listauto(self, ctx):
response = "Scheduled Auto Messages:\n\n"
for message_id, data in self.auto_messages.items():
channel_id = data["channel_id"]
channel = self.bot.get_channel(channel_id)
channel_name = channel.name if channel is not None else "Unknown Channel"
interval = data["interval"]
response += f"Auto Message ID: {message_id}\n"
response += f"Channel: {channel_name}\n"
response += f"Interval: {interval}s\n"
if data["repeat"]:
response += "Repeat: Yes\n"
else:
response += "Repeat: No\n"
response += "\n"
await ctx.send(response, delete_after=30)
@commands.command(name='stopauto', aliases=['sam','stopam'], brief="Stop auto message", usage=".stopauto <auto.message.id>")
@infected()
async def stopauto(self, ctx, message_id: int):
str_message_id = str(message_id)
if str_message_id not in self.auto_messages:
await ctx.send("No auto message found with the specified ID")
return
self.auto_message_tasks[str_message_id].cancel()
del self.auto_message_tasks[str_message_id]
del self.auto_messages[str_message_id]
self.save_auto_messages()
await ctx.send("Auto message stopped", delete_after=5)
@commands.command(name='deleteallauto', aliases=['daa', 'deleteamall'], brief="Delete all auto messages", usage=".deleteallauto")
@infected()
async def deleteallauto(self, ctx):
self.auto_messages.clear()
for task in self.auto_message_tasks.values():
task.cancel()
self.auto_message_tasks.clear()
self.save_auto_messages()
await ctx.send("All auto messages deleted", delete_after=5)
def setup(bot):
bot.add_cog(Automsg(bot))
class Dump(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name="alldump", usage="<channel>", description="Dump all from a channel")
@infected()
async def alldump(self, ctx, channel: discord.TextChannel):
if not os.path.exists(f"data/dumping/all/{channel.guild.name}/{channel.name}"):
os.makedirs(f"data/dumping/all/{channel.guild.name}/{channel.name}")
try:
async for message in channel.history(limit=None):
for attachment in message.attachments:
r = requests.get(attachment.url, stream=True)
with open(f'data/dumping/all/{channel.guild.name}/{channel.name}/{attachment.filename}', 'wb') as f:
f.write(r.content)
await ctx.send("Dumped all content.")
except Exception as e:
await ctx.send(f"An error occurred: {e}")
@commands.command(name="imgdump", usage="<channel>", description="Dump images from a channel")
@infected()
async def imgdump(self, ctx, channel: discord.TextChannel):
if not os.path.exists(f"data/dumping/images/{channel.guild.name}/{channel.name}"):
os.makedirs(f"data/dumping/images/{channel.guild.name}/{channel.name}")
try:
async for message in channel.history(limit=None):
for attachment in message.attachments:
if attachment.url.endswith((".png", ".jpg", ".jpeg", ".gif")):
r = requests.get(attachment.url, stream=True)
with open(f'data/dumping/images/{channel.guild.name}/{channel.name}/{attachment.filename}', 'wb') as f: