-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (32 loc) · 1.29 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
# Please Buy the working script- This is only a simulation!
#Telegram- @witchshophub
import os
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
def encrypt_file(file_path, key):
output_file = file_path + ".enc"
with open(file_path, 'rb') as f:
data = f.read()
cipher = AES.new(key, AES.MODE_CBC)
ciphertext = cipher.encrypt(pad(data, AES.block_size))
with open(output_file, 'wb') as f:
f.write(cipher.iv)
f.write(ciphertext)
print(f"🔐 Encrypted file saved as: {output_file}")
def decrypt_file(enc_file_path, key):
output_file = enc_file_path.replace(".enc", ".dec.exe")
with open(enc_file_path, 'rb') as f:
iv = f.read(16)
ciphertext = f.read()
cipher = AES.new(key, AES.MODE_CBC, iv=iv)
data = unpad(cipher.decrypt(ciphertext), AES.block_size)
with open(output_file, 'wb') as f:
f.write(data)
print(f"🔓 Decrypted file saved as: {output_file}")
if __name__ == "__main__":
key = os.urandom(16) # Generate a random 16-byte key
file_path = input("Enter the path of the EXE file to encrypt: ")
encrypt_file(file_path, key)
# Decryption for testing purposes
enc_file_path = file_path + ".enc"
decrypt_file(enc_file_path, key)