-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
2199 lines (2057 loc) · 97.5 KB
/
index.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 sys
sys.dont_write_bytecode = True
elliptic_private_key_pem = """
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIP7I0fsNgSfPCRggdnEFXarwWUGuLBBmalFMQNnoHDZdoAcGBSuBBAAK
oUQDQgAE/tolsS0q6NQIynNqs+efEKUVv4TRwZCNMgHF41mrveMxCOfoYG8m6ew8
JK36TXLwgSDZeMC4RDHnOTDTsbeceg==
-----END EC PRIVATE KEY-----
"""
elliptic_public_key_pem = """
-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/tolsS0q6NQIynNqs+efEKUVv4TRwZCN
MgHF41mrveMxCOfoYG8m6ew8JK36TXLwgSDZeMC4RDHnOTDTsbeceg==
-----END PUBLIC KEY-----
"""
# Private key in PEM format
private_key_pem = b"""
-----BEGIN RSA PRIVATE KEY-----
MIIJJgIBAAKCAgB7/3o2EI0vYMc6WUMmZGlaSZZ3w8WMRTdl6Z1RoKiyBPFY9jmy
Grbismvx7Vj/jRNt6aCKM1N83WkXNIEwCpOgWK1BoM7CaNu+VDr/bVd9UoAqYcdQ
uA4383hlAoTenln2t42Rk0sV9HsVa9uo6ZDTGURdbE79lrKxkwwM5p2La+8RtVWT
Z+k4VOfIbOvurwN6Ovct2RG03FB2URfAqY6GN/5WnCcFKWTO/tn/Bm6wLh6xGmBS
SjA8OUDYl5PE4EaxrmODnf+L7nOjIGpOGZ6cYkE9XhOjjr+1IOzv3OoKTYyn9Odu
6+jbV0lPksbnYFxG0kuFZIirt5EwEH+juaXsGoxGiqP6hTZEocMAHomEzabDNY1B
9Y+3YhyC4RP59ifd8fo/uD7DGQvxRgO9dGpwprTZfKrPxFCT9p17vw8/rOY88Cqb
dczF7BoMiLolKDq4YVxOhYreKj3NTyqrV5+xEuqfmTFJ6D/uEMAGnSRYMQneBJIC
wn1j0G78jkn8aMQcTofEOXG1UjDMKKvjfNfK4lLNB2VJzx6o/zd/vUYTjqYAotV0
dRrPPUJ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KKvjfNfK
4lLNB2VJzx6o/zd/vUYTjqYAotV0dRrPPUJYXjWd0ZDL6PruQMW88gLfLJrV8WMY
NgfV1A/YrJ2TrM+goS2aAYQ+gIPmUgmgZSigqTDOV5ELz/JFTJ3/dMD5kg+rEBJY
pwMSluAcoe/e+puxkA3PYwIDAQAB
-----END PUBLIC KEY-----
"""
import threading
import argparse
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import parse_qs
import os
import socket
import base64
import binascii
import json
import hashlib
import time
import zlib
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad, unpad
import webbrowser
import random
import asyncio
import websockets
import subprocess
import requests
from bs4 import BeautifulSoup
import datetime
import string
from Cryptodome.PublicKey import RSA
from Cryptodome.Signature import pkcs1_15
from Cryptodome.Cipher import PKCS1_v1_5
from Cryptodome.Hash import SHA256
from Cryptodome.Cipher import PKCS1_OAEP
import elliptic
import ecdsa
from ecdsa import VerifyingKey, util
import re
import colorama
colorama.init()
# pip install pycryptodome
# pip install pycryptodomex
# pip install websockets
# pip install requests
# pip install beautifulsoup4
# pip install ecdsa
# pip install elliptic
# Disable bytecode writing for the Crypto module
sys.modules['Cryptodome'].__dict__['__file__'] = ''
host = '127.0.0.1'
port = 80
listen = False
chatbotinvtext = ''.join(random.choices(string.ascii_letters + string.digits, k=512))
x1iv = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
httpd = None
server_thread = None
__process_close__ = 0
def banner():
print('''
...
;::::;
;::::; :;
;:::::' :;
;:::::; ;.
,:::::' ; OOO\
::::::; ; OOOOO\
;:::::; ; OOOOOOOO
,;::::::; ;' / OOOOOOO
;:::::::::`. ,,,;. / / DOOOOOO
.';:::::::::::::::::;, / / DOOOO
,::::::;::::::;;;;::::;, / / DOOO
;`::::::`'::::::;;;::::: ,#/ / DOOO
:`:::::::`;::::::;;::: ;::# / DOOO
::`:::::::`;:::::::: ;::::# / DOO
`:`:::::::`;:::::: ;::::::#/ DOO
:::`:::::::`;; ;:::::::::## OO
::::`:::::::`;::::::::;:::# OO
`:::::`::::::::::::;'`:;::# O
`:::::`::::::::;' / / `:#
::::::`:::::;' / / `#
''')
def str_splitx(string, splitLength):
if splitLength is None:
splitLength = 1
if string is None or splitLength < 1:
return False
string += ""
chunks = []
pos = 0
length = len(string) # Use a different name for the local variable
while pos < length:
chunks.append(string[pos:pos + splitLength])
pos += splitLength
return chunks
# SIGN-FLEX-DUAL
async def encryptDataserver(cache_x_RSA, target_public_x_key,ec_private_key):
# Get Elliptic Private Key
cache_signp = ""
if ec_private_key.strip().decode().startswith("-----BEGIN EC PRIVATE KEY-----"):
signingKey = ecdsa.SigningKey.from_pem(ec_private_key.strip())
else:
signingKey = ecdsa.SigningKey.from_string(bytes.fromhex(ec_private_key.strip().decode()),curve=ecdsa.SECP256k1)
# Sign
privKeyHex = signingKey.to_string().hex()
privKey = int(privKeyHex, 16)
signingKey = ecdsa.SigningKey.from_secret_exponent(privKey, curve=ecdsa.SECP256k1, hashfunc=hashlib.sha256)
cache_signp = signingKey.sign(cache_x_RSA.encode(), hashfunc=hashlib.sha256).hex()
# Encrypt
encryped_data=""
cache_12312asdasdas3 = str_splitx(cache_x_RSA, 256)
for data10 in cache_12312asdasdas3:
crypt = RSA.import_key(target_public_x_key.strip())
cipher = PKCS1_v1_5.new(crypt)
axxx1 = base64.b64encode(cipher.encrypt(data10.encode()))
encryped_data = encryped_data + axxx1.decode() + "#"
encryped_data = encryped_data + cache_signp
return encryped_data
async def decryptDataserver(encryptedData, myprivate,ec_public_key):
decryptedData = ""
try:
parts = re.split("#", encryptedData)
# Get Signature
signature = parts[-1]
# Decrypt
for part in parts[:-1]:
crypt = RSA.import_key(myprivate.strip())
cipher = PKCS1_v1_5.new(crypt)
dd1 = cipher.decrypt(base64.urlsafe_b64decode(part),None)
decryptedData = decryptedData + dd1.decode()
if ec_public_key.strip().decode().startswith("-----BEGIN PUBLIC KEY-----"):
# assume it is PEM format
verifying_key = ecdsa.VerifyingKey.from_pem(ec_public_key.strip())
signature_bytes = bytes.fromhex(signature.strip())
is_signature_valid = verifying_key.verify(signature_bytes, decryptedData.encode(), hashfunc=hashlib.sha256)
else:
# assume it is hex format
verifying_key = ecdsa.VerifyingKey.from_string(bytes.fromhex(ec_public_key.strip().decode()),curve=ecdsa.SECP256k1)
signature_bytes = bytes.fromhex(signature.strip())
is_signature_valid = verifying_key.verify(signature_bytes, decryptedData.encode(), hashfunc=hashlib.sha256)
if not is_signature_valid:
raise Exception("Invalid signature!")
except Exception as e:
print("Decryption failed! " + str(e))
return decryptedData
# SIGN-MIX-DUAL
# async def encryptDataserver(cache_x_RSA, target_public_x_key,ec_private_key):
# cache_signp = ""
# cache_109 = str_splitx(cache_x_RSA, 256) # I assume this is a custom function to split a string into chunks of 128 characters
# crypted0193 = []
# asjdasjdajs = []
# for data5 in cache_109:
# fsdkjf34o2it2 = base64.b64encode(data5.encode())
# if ec_private_key.strip().decode().startswith("-----BEGIN EC PRIVATE KEY-----"):
# # assume it is PEM format
# signingKey = ecdsa.SigningKey.from_pem(ec_private_key.strip())
# else:
# # assume it is hex format
# signingKey = ecdsa.SigningKey.from_string(bytes.fromhex(ec_private_key.strip().decode()),curve=ecdsa.SECP256k1)
# privKeyHex = signingKey.to_string().hex()
# privKey = int(privKeyHex, 16)
# signingKey = ecdsa.SigningKey.from_secret_exponent(privKey, curve=ecdsa.SECP256k1, hashfunc=hashlib.sha256)
# # Veriyi imzalarken hashlib.sha256 fonksiyonunu çağırın
# cache_signp = signingKey.sign(fsdkjf34o2it2, hashfunc=hashlib.sha256)
# asjdasjdajs.append({"text": fsdkjf34o2it2.decode(), "sign": cache_signp.hex()}) # Append the data and the signature to the list
# cache_123123 = json.dumps(asjdasjdajs) # Convert the list to JSON string
# cryptedasdasdas1111 = []
# cache_12312asdasdas3 = str_splitx(cache_123123, 256) # Split the JSON string into chunks of 128 characters
# for data10 in cache_12312asdasdas3:
# # Encrypt the data with public key
# crypt = RSA.import_key(target_public_x_key.strip()) # Import the public key from PEM format
# cipher = PKCS1_v1_5.new(crypt) # Create a PKCS1_OAEP cipher object
# cryptedasdasdas1111.append(base64.b64encode(base64.b64encode(cipher.encrypt(data10.encode()))).decode()) # Encrypt and base64 encode the data and append to the list
# crypted0193.append(base64.b64encode(json.dumps(cryptedasdasdas1111).encode()).decode()) # Convert the list to JSON string and base64 encode and append to the list
# return base64.b64encode(json.dumps(crypted0193).encode()).decode() # Convert the list to JSON string and base64 encode and return as string
# async def decryptDataserver(encryptedData, myprivate,ec_public_key):
# decryptedData = ""
# try:
# crypted0193 = json.loads(base64.urlsafe_b64decode(encryptedData)) # Decode and parse the JSON string
# cryptedasdasdas1111 = json.loads(base64.urlsafe_b64decode(crypted0193[0])) # Decode and parse the JSON string
# asjdasjdajs = []
# asdasdasd = ""
# for data10 in cryptedasdasdas1111:
# crypt = RSA.import_key(myprivate.strip()) # Import the private key from PEM format
# cipher = PKCS1_v1_5.new(crypt) # Create a PKCS1_OAEP cipher object
# decryptedData1 = cipher.decrypt(base64.urlsafe_b64decode(base64.urlsafe_b64decode(data10)),None) # Decode and decrypt the data
# asdasdasd = asdasdasd + decryptedData1.decode() # Concatenate the decrypted data
# asjdasjdajs = asjdasjdajs + json.loads(asdasdasd) # Parse the JSON string and append to the list
# for data5 in asjdasjdajs:
# # var crypt123123123 = new JSEncrypt(); // RSA ile imzalamayı kaldır
# # crypt123123123.setPublicKey(key); // RSA ile imzalamayı kaldır
# signature = data5["sign"]
# plaintext = data5["text"]
# if ec_public_key.strip().decode().startswith("-----BEGIN PUBLIC KEY-----"):
# # assume it is PEM format
# verifying_key = ecdsa.VerifyingKey.from_pem(ec_public_key.strip())
# signature_bytes = bytes.fromhex(signature.strip())
# is_signature_valid = verifying_key.verify(signature_bytes, plaintext.encode(), hashfunc=hashlib.sha256)
# else:
# # assume it is hex format
# verifying_key = ecdsa.VerifyingKey.from_string(bytes.fromhex(ec_public_key.strip().decode()),curve=ecdsa.SECP256k1)
# signature_bytes = bytes.fromhex(signature.strip())
# is_signature_valid = verifying_key.verify(signature_bytes, plaintext.encode(), hashfunc=hashlib.sha256)
# if is_signature_valid:
# decryptedData += base64.urlsafe_b64decode(plaintext).decode() # Decode and append the plaintext to the decrypted data
# else:
# raise Exception("Invalid signature!")
# except Exception as e:
# print("Decryption failed! " + str(e))
# return decryptedData
data = None
with open("cb1.json", "r", encoding="utf-8") as f:
data = json.load(f)
def multi_thread(text):
global data
cevap = ""
metin = text.split()
for key in data["multi"]:
if key.startswith("set"):
sub_keys = data["multi"][key].split("=")[-1].split()
left_keyx = data["multi"][key].split("=")[0].split(",")
for i in range(len(sub_keys)):
for c in range(len(left_keyx)):
current_sub_key = sub_keys[i]
left_key = left_keyx[c].split("+")
if len(left_key) == 1:
for a in range(len(left_key)):
left_key1 = left_key[a].split("/")
for c in range(len(left_key1)):
if left_key1[c] in metin:
response = data["multi"][current_sub_key.replace("$","")].split("/")
if not any(item in cevap for item in response):
if len(response) == 1:
cevap += response[0] + " "
else:
cevap += random.choice(response) + " "
else:
sayac = 0
for a in range(len(left_key)):
left_key1 = left_key[a].split("/")
for c in range(len(left_key1)):
if left_key1[c] in metin:
sayac=sayac+1
if len(left_key) == sayac:
response = data["multi"][current_sub_key.replace("$","")].split("/")
if not any(item in cevap for item in response):
sayac = 0
if len(response) == 1:
cevap += response[0] + " "
else:
cevap += random.choice(response) + " "
if cevap == "":
return None
else:
return cevap.strip()
def single_thread(text):
global data
text = text.strip()
if text in data["single"]:
response = data["single"][text]
if len(response) == 1:
cevap = response[0] + " "
else:
cevap = random.choice(response) + " "
return cevap.strip()
else:
return None
def cevapla(metin):
global data
metin = metin.lower().replace("?","").replace("!","")
cevap = ""
test = single_thread(metin)
if test is not None:
return test
test = multi_thread(metin)
if test is not None:
return test
return random.choice(data["multi"]["default"]).strip()
#print(cevapla(input("Bot a sor : ")))
def encrypt(key, iv, plaintext):
try:
# Create AES-CBC cipher.
cipher = AES.new(key, AES.MODE_CBC, iv)
# Encrypt and return the IV and ciphertext.
ciphertext = cipher.encrypt(pad(plaintext.encode(), AES.block_size))
return ciphertext
except Exception as e:
print("Encryption error:", e)
return None
def decrypt(key, iv, ciphertext):
try:
# Create AES-CBC cipher.
cipher = AES.new(key, AES.MODE_CBC, iv)
# Decrypt and return the plaintext.
plaintext = unpad(cipher.decrypt(ciphertext), AES.block_size)
return plaintext.decode()
except Exception as e:
print("Decryption error:", e)
return None
general_token = {}
def generatekey_general_token(key):
global general_token
name = ''.join(random.choices(string.ascii_letters + string.digits, k=256))
general_token[name] = key.encode()
if len(general_token) > 32:
oldest_name = next(iter(general_token))
del general_token[oldest_name]
return name, key
def delete_general_token(token):
global general_token
if token in general_token:
del general_token[token]
return True
else:
return False
aes256_token = {}
def generatekeyAES256():
global aes256_token
key = ''.join(random.choices(string.ascii_letters + string.digits, k=32))
name = ''.join(random.choices(string.ascii_letters + string.digits, k=64))
aes256_token[name] = key.encode()
if len(aes256_token) > 32:
oldest_name = next(iter(aes256_token))
del aes256_token[oldest_name]
return name, key
def aes256_token_exists(name):
global aes256_token
return name in aes256_token
def delete_aes256_token(token):
global aes256_token
if token in aes256_token:
del aes256_token[token]
return True
else:
return False
def test_decrypt_aes256_token(token, ciphertext):
global aes256_token, x1iv
if not aes256_token_exists(token):
return False
try:
decoded_ciphertext = base64.b64decode(ciphertext.encode())
value = str(decrypt(aes256_token[token], x1iv.encode(), decoded_ciphertext))
if delete_aes256_token(token):
return value
else:
return False
except:
return False
def test_decrypt_aes256_token_wait(token, ciphertext):
global aes256_token, x1iv
if not aes256_token_exists(token):
print("Token Bulunamadı")
print(token)
print(aes256_token)
return False
try:
decoded_ciphertext = base64.b64decode(ciphertext.encode())
value = str(decrypt(aes256_token[token], x1iv.encode(), decoded_ciphertext))
return value
except:
print("Error Expect")
return False
def generateToken_str():
now = datetime.datetime.now()
year = str(now.year)
month = str(now.month).zfill(2)
day = str(now.day).zfill(2)
hour = str(now.hour).zfill(2)
minute = str(now.minute).zfill(2)
second = str(now.second).zfill(2)
randomPassword = ''.join(random.choices(string.ascii_letters + string.digits, k=64))
token = year + month + day + hour + minute + second + randomPassword
return hashlib.sha256(token.encode()).hexdigest()
PASSWORD = generateToken_str()
SALT = generateToken_str()
# Global file_token list
file_token = {generateToken_str():"crypto-js.min.js",generateToken_str():"jquery-3.6.4.min.js",generateToken_str():"jsencrypt.min.js",generateToken_str():"abc.css",generateToken_str():"a.css",generateToken_str():"a1b.css",generateToken_str():"functions.js",generateToken_str():"elliptic.min.js",generateToken_str():"[email protected]"}
# Global token list
tokens = []
def token_exists(token):
for t in tokens:
if t == token:
return True
return False
def generate_token(token_string):
# Generate sha256 hash of the input string
sha256_hash = hashlib.sha256(token_string.encode()).hexdigest()
# Check if token already exists in the list
if token_exists(sha256_hash):
return "This token is already used"
# Add the token to the beginning of the list
tokens.insert(0, sha256_hash)
# If the list has more than 32 tokens, remove the last one
if len(tokens) > 32:
tokens.pop()
# Return the generated token
return sha256_hash
def token_login(token_string):
# Generate sha256 hash of the input string
sha256_hash = hashlib.sha256(token_string.encode()).hexdigest()
# Check if the token is in the list and remove it
if sha256_hash in tokens:
tokens.remove(sha256_hash)
return True
# If the token is not in the list, return False
return False
def list_tokens():
global tokens
print(" >> Token list:")
if tokens:
for token in tokens:
if token is not None:
print(token)
else:
print("None")
# Global token list
invs = []
def inv_exists(token):
for t in invs:
if t == token:
return True
return False
def generate_inv():
# Generate sha256 hash of the input string
random_inv = base64.urlsafe_b64encode(os.urandom(48)).decode().replace('-', 'x').replace('_', 'a')
# Check if token already exists in the list
if inv_exists(random_inv):
generate_inv()
return "This inv is already used"
# Add the token to the beginning of the list
invs.insert(0, random_inv)
# If the list has more than 32 invs, remove the last one
if len(invs) > 32:
invs.pop()
# Return the generated token
return random_inv
def inv_login(inv_string):
# Check if the token is in the list and remove it
if inv_string in invs:
invs.remove(inv_string)
return True
# If the token is not in the list, return False
return False
def list_inv():
global invs,host,port
print(" >> invs list:")
if invs:
for inv in invs:
if inv is not None:
print(f"http://{host}:{port}/?inv="+ inv)
else:
print("None")
def crc32bhash(string):
# Calculate the CRC32b hash of the string.
crc32b_hash = zlib.crc32(string)
# Convert the CRC32b hash to a string.
crc32b_hash_string = hex(crc32b_hash)[2:]
# Return the CRC32b hash as a string.
return crc32b_hash_string
server_memory_encrypt_key_Hash=None
server_memory_encrypt_iv_Hash=None
server_key=None
def set_memory_hash(text):
global server_memory_encrypt_key_Hash,server_memory_encrypt_iv_Hash,server_key
server_key = text
key = hashlib.sha256(text.encode()).digest()
iv = hashlib.md5(text.encode()).digest()
server_memory_encrypt_key_Hash = hashlib.sha512(key).hexdigest()
server_memory_encrypt_iv_Hash = hashlib.sha512(iv).hexdigest()
return True
def set_password(text):
global PASSWORD
PASSWORD = text
return True
def print_server_key():
if server_memory_encrypt_key_Hash and server_memory_encrypt_iv_Hash:
print(f' >> Server Key Hash: {server_memory_encrypt_key_Hash}{server_memory_encrypt_iv_Hash}')
else:
print(f' >> Server Key Hash: None')
def memory_key_generate(text):
key = hashlib.sha256(text.encode()).digest()
iv = hashlib.md5(text.encode()).digest()
return key,iv
encrypted_messages = []
async def mesajat(message,key,iv, target,islem=0):
if hashlib.sha512(key).hexdigest() == server_memory_encrypt_key_Hash and hashlib.sha512(iv).hexdigest() == server_memory_encrypt_iv_Hash:
if len(key) != 32:
return "Key size not suitable, must be 32 bytes"
if len(iv) != 16:
return "IV size is not appropriate, must be 16 bytes"
crc32message=crc32bhash(message.encode())
try:
encrypted = base64.b64encode(encrypt(key, iv, message)).decode()
except Exception as e:
encrypted = colored_write(f" (!) Encryption error: {e}")
return encrypted
if islem==1:
encrypted="___PUBLICKEY___"+encrypted
new_add_data = {
"crc32b": crc32message,
"time": "19:06:08 10/04/2023",
"id": "x",
"text": encrypted,
"type": "normal"
}
encrypted_messages.insert(0, new_add_data)
if len(encrypted_messages) > 100:
encrypted_messages.pop(-1)
return "Message was sent to " + target
else:
return " (!) Server Key Error"
def mesajlari_oku(key,iv,encrypted_messages_cache):
global server_memory_encrypt_key_Hash, server_memory_encrypt_iv_Hash
if hashlib.sha512(key).hexdigest() == server_memory_encrypt_key_Hash and hashlib.sha512(iv).hexdigest() == server_memory_encrypt_iv_Hash:
if len(key) != 32:
return "Key size not suitable, must be 32 bytes"
if len(iv) != 16:
return "IV size is not appropriate, must be 16 bytes"
decrypted_messages = []
for message in encrypted_messages_cache:
try:
if message['text'].startswith("___PUBLICKEY___"):
messagexx = message['text'].split("___PUBLICKEY___")[1]
decrypted_message = decrypt(key, iv, base64.b64decode(messagexx))
if message['crc32b'] != crc32bhash(decrypted_message.encode()):
decrypted_messages.append('(!) CRC32B Error: Message changed')
else:
new_add_data = {
"crc32b": message['crc32b'],
"time": message['time'],
"id": message['id'],
"text": "___PUBLICKEY___"+decrypted_message,
"type": message['type']
}
decrypted_messages.append(new_add_data)
else:
messagexx = message['text']
decrypted_message = decrypt(key, iv, base64.b64decode(messagexx))
if message['crc32b'] != crc32bhash(decrypted_message.encode()):
decrypted_messages.append('(!) CRC32B Error: Message changed')
else:
new_add_data = {
"crc32b": message['crc32b'],
"time": message['time'],
"id": message['id'],
"text": decrypted_message,
"type": message['type']
}
decrypted_messages.append(new_add_data)
except Exception as e:
decrypted_messages.append(f"Decrypt Error: {e}")
return decrypted_messages
else:
return None
def print_decrypted_messages(decrypted_messages):
if decrypted_messages==None:
print(colored_write(" (!) Key Error"))
elif decrypted_messages=="view":
global encrypted_messages
print(" >> Encrypted Data List:")
if encrypted_messages:
for message in encrypted_messages:
if isinstance(message, dict) and 'time' in message and 'text' in message and 'id' in message and 'type' in message and 'crc32b' in message:
if message['text'].startswith("___PUBLICKEY___"):
messagexx = message['text'].split("___PUBLICKEY___")[1]
print(f"Data: ___PUBLICKEY___{messagexx}___END_PUBLICKEY___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}")
else:
print(f"Data: {message['text']} {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}")
elif isinstance(message, str):
print(message)
else:
print("Invalid message format")
else:
print("None")
else:
print(" >> Message List:")
if decrypted_messages:
for message in decrypted_messages:
if isinstance(message, dict) and 'time' in message and 'text' in message and 'id' in message and 'type' in message and 'crc32b' in message:
if message['text'].startswith("___PUBLICKEY___"):
messagexx = message['text'].split("___PUBLICKEY___")[1]
print(f"___PUBLICKEY___{messagexx}___END_PUBLICKEY___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}")
else:
print(f"Message: ___text___{message['text']}___end_text___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}")
elif isinstance(message, str):
print(message)
else:
print("Invalid message format")
else:
print("None")
def return_decrypted_messages(decrypted_messages):
cache_asdas_012302=""
if decrypted_messages==None:
cache_asdas_012302="(!) Key Error"
else:
if decrypted_messages:
for message in decrypted_messages:
if isinstance(message, dict) and 'time' in message and 'text' in message and 'id' in message and 'type' in message and 'crc32b' in message:
if message['text'].startswith("___PUBLICKEY___"):
messagexx = message['text'].split("___PUBLICKEY___")[1]
cache_asdas_012302 += (f"___PUBLICKEY___{messagexx}___END_PUBLICKEY___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}") + "<br>"
else:
cache_asdas_012302 += (f"___text___{message['text']}___end_text___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}") + "<br>"
elif isinstance(message, str):
cache_asdas_012302 += (message) + "\n"
else:
cache_asdas_012302 += ("Invalid message format") + "<br>"
else:
cache_asdas_012302 = ("None")
return cache_asdas_012302
def return_broadcast_messages(key, iv):
global encrypted_messages
messages = []
if encrypted_messages:
messages.append(encrypted_messages[0])
cache_asdas_012302 = ""
try:
for message in messages:
if message['text'].startswith("___PUBLICKEY___"):
messagexx = message['text'].split("___PUBLICKEY___")[1]
decrypted_message = decrypt(key, iv, base64.b64decode(messagexx))
if message['crc32b'] != crc32bhash(decrypted_message.encode()):
cache_asdas_012302 += '(!) CRC32B Error: Message changed\n'
else:
cache_asdas_012302 += f"___PUBLICKEY___{decrypted_message}___END_PUBLICKEY___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}\n"
else:
messagexx = message['text']
decrypted_message = decrypt(key, iv, base64.b64decode(messagexx))
if message['crc32b'] != crc32bhash(decrypted_message.encode()):
cache_asdas_012302 += '(!) CRC32B Error: Message changed\n'
else:
cache_asdas_012302 += f"___text___{decrypted_message}___end_text___ {message['time']} ID:{message['id']} CRC32B:{message['crc32b']} {message['type']}\n"
except Exception as e:
cache_asdas_012302 += f"Decrypt Error: {e}\n"
if not messages:
cache_asdas_012302 = "None"
return cache_asdas_012302
else:
return None
def get_token_variables(file_token):
tokens = list(file_token.keys())
return tuple(tokens)
random_token=None
class StaticServer(BaseHTTPRequestHandler):
def log_message(self, format, *args):
return
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.directory = 'www'
def do_GET(self):
global random_token
token1 = self.path[1:]
if token1 in file_token:
file_name = file_token[token1]
file_extension = os.path.splitext(file_name)[1]
if file_extension == '.css':
file_type = 'text/css'
elif file_extension == '.js':
file_type = 'text/javascript'
else:
file_type = 'text/plain'
try:
file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'www', file_name)
with open(file_path, 'rb') as file:
content = file.read()
self.send_response(200)
self.send_header('Content-type', file_type)
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
self.send_header('Expires', '0')
self.send_header('Pragma', 'no-cache')
self.end_headers()
self.wfile.write(content)
except:
self.send_error(404)
return
if self.path == '/':
self.path = '/index.html'
try:
file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'www', self.path[1:])
if not os.path.exists(file_path):
raise Exception(f'File "{file_path}" not found!')
with open(file_path, 'rb') as file:
content = file.read()
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
self.send_header('Expires', '0')
self.send_header('Pragma', 'no-cache')
self.end_headers()
self.wfile.write(content)
except Exception as e:
self.send_error(404, f'Error: {e}')
elif self.path.startswith('/?token='):
token = self.path.split('=')[1]
if token == random_token:
message = 'Please set the server key:'
content = f'''
<html>
<body>
<h2>{message}</h2>
<form method="post" action="/{nametoken_cache}">
<input type="text" name="server_key" id="server_key" autocomplete="off">
<input type="submit">
</form>
</body>
</html>
'''
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
self.send_header('Expires', '0')
self.send_header('Pragma', 'no-cache')
self.end_headers()
self.wfile.write(content.encode())
return
else:
return
elif self.path.startswith('/?inv='):
if server_key == None:
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
self.send_header('Expires', '0')
self.send_header('Pragma', 'no-cache')
self.end_headers()
self.wfile.write("Server Key Not Found".encode())
return
inv = self.path.split('=')[1]
if inv_login(inv):
token1, token2, token3, token4, token5, token6, token7, token8, token9 = get_token_variables(file_token)
namex89, keyx98 = generatekeyAES256()
#print(x1iv)
#print("KEY:"+keyx98)
#asdasdas = base64.b64encode(encrypt(keyx98.encode(), x1iv.encode(), "123")).decode()
#print(asdasdas)
#print(decrypt(keyx98.encode(), x1iv.encode(), base64.b64decode(asdasdas)))
keyx98 = keyx98.encode().hex()
namex89 = namex89
namex89_public_key, keyx98_public_key = generatekeyAES256()
keyx98_public_key = keyx98_public_key.encode().hex()
namex89_public_key = namex89_public_key
namexserver_key, keyxserver_key = generatekeyAES256()
server_key_token_encrypted = namexserver_key + "#" + base64.b64encode(encrypt(keyxserver_key.encode(), x1iv.encode(), server_key)).decode()
namexdecrypt_server_key, keyxdecrypt_server_key = generatekeyAES256()
decrypt_server_key_token_encrypted = namexdecrypt_server_key + "#" + base64.b64encode(encrypt(keyxdecrypt_server_key.encode(), x1iv.encode(), server_key)).decode()
#asdasdas = base64.b64encode(encrypt(keyxserver_key.encode(), x1iv.encode(), server_key)).decode()
#print(decrypt(keyxserver_key.encode(), x1iv.encode(), base64.b64decode(asdasdas)))
content = f'''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> </title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta http-equiv="pragma" content="no-cache">
<meta name="subject" content="">
<meta name="description" content="">
<Meta name="Classification" content="">
<Meta name="rating" content="">
<meta name="category" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="robots" content="index, follow">
<meta http-equiv="content-type" content="text/html;UTF-8">
<meta http-equiv="content-language" content="en">
<meta http-equiv="expires" content="">
<meta http-equiv="revisit-after" content="">
<script>
var decrypt_location = "/{namedecrypt_cache}";
var token_location = "/{nametokenpost_cache}";
var server_key = "{server_key}";
var decrypt_server_key_x = "{decrypt_server_key_token_encrypted}";
var encrypt_1_iv = "{x1iv.encode().hex()}";
safe_thread_ok=false;
</script>
<script src="/{token9}"></script>
<script src="/{token1}"></script>
<script src="/{token2}"></script>
<script type="text/javascript" src="/{token3}"></script>
<link rel="stylesheet" href="/{token4}">
<link rel="stylesheet" href="/{token5}">
<link rel="stylesheet" href="/{token6}">
<script src="/{token8}"></script>
<script src="/{token7}"></script>
</head>
<body style="background-color:black!important;">
<serverpublickey style='display:none'>{public_key_pem.decode()}</serverpublickey>
<mypublicelliptic style='display:none'></mypublicelliptic>
<myprivateelliptic style='display:none'></myprivateelliptic>
<div id="deathpage" style="display:none;color:white;">
<h1>Connection Was Slained By Server :(</h1>
</div>
<div id="loading" style="display: none;position: absolute;top: 0;left: 0;z-index: 100;width: 100vw;height: 100vh;background-color: black;background-repeat: no-repeat;background-position: center;"><div style="margin:0 auto;text-align:center;height:auto;"><br><br><!-- SPINNER ORBITS -->
<div class="spinner-box">
<div class="blue-orbit leo">
</div>
<div class="green-orbit leo">
</div>
<div class="red-orbit leo">
</div>
<div class="white-orbit w1 leo">
</div><div class="white-orbit w2 leo">
</div><div class="white-orbit w3 leo">
</div>
</div><br><loading-durum style='color:white;margin:0 auto;font-size:24px;'>Your friend didn't come or Your Processor Is Used For RSA 2048 Bit Encryption Key Generation</loading-durum></div></div>
<script>
var safe_retry_rsa=true;
function changedurum(asdasdasdadasd){{
$("loading-durum").html(asdasdasdadasd);
}}
function setVisible(selector, visible) {{
document.querySelector(selector).style.display = visible ? 'block' : 'none';
}}
function killpage(){{
$('serverpublickey').html('');
$('mypublic').html('');
$('myprivate').html('');
$('targetpublic').html('');
$('mypublicelliptic').html('');
$('myprivateelliptic').html('');
$('#messages').html('');
setVisible('main', false);
setVisible('#loading', false);
setVisible('#deathpage', true);
}}
function openloading(){{
setVisible('main', false);
setVisible('#loading', true);
}}
function closeloading(){{
setVisible('main', true);
setVisible('#loading', false);
}}
</script>
<main>
<div style="margin:0 auto;text-align:center;height:auto;color:grey;max-width:600px;">