-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobfuscatee.py
More file actions
122 lines (95 loc) · 3.15 KB
/
obfuscatee.py
File metadata and controls
122 lines (95 loc) · 3.15 KB
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
"""
SCRIPT INI DI BUAT OLEH VINDRA GANZZ MENGGUNAKAN METODE SNIFF
KAMU BISA PAKAI SCRIPT INI UNTUK ENCRYPT PYTHON
WEBSITE https://pyobfuscate.com
SCRIPT TIDAK PERLU SALIN ,LANGUSNG MASUKAN FILE .PY
@VINDRA GANZZ
TANKS
SEMUANYA ^__^
"""
import requests
from bs4 import BeautifulSoup
import re
import zlib
import string
import os
from fake_useragent import UserAgent
from requests import Session
ses = Session()
ses = UserAgent()
agent = ses.random
def read_source_code(file_path):
try:
with open(file_path, "r") as f:
return f.read()
except FileNotFoundError:
print(f"File tidak ditemukan: {file_path}")
exit()
def obfuscate_code(source_code):
try:
session = requests.Session()
url = "https://pyobfuscate.com/pyd"
session.get(url)
headers = {
"User-Agent": agent,
"Content-Type": "application/x-www-form-urlencoded",
"Referer": url,
"Origin": "https://pyobfuscate.com"
}
res = session.post(url, headers=headers, data={"pyinput": source_code})
soup = BeautifulSoup(res.text, "html.parser")
textareas = soup.find_all("textarea")
if len(textareas) < 2:
print("Gagal mengambil hasil obfuscate.")
exit()
return textareas[1].text
except Exception as e:
print(f"agal saat proses obfuscate: {e}")
exit()
def extract_hex_payload(obfuscated_code):
match = re.search(r"'lIlIIIlIlIIIlI'\s*,\s*['\"]{3}(.*?)['\"]{3}", obfuscated_code, re.DOTALL)
if not match:
print("idak ditemukan hex terenkripsi.")
exit()
hex_data = match.group(1).strip()
return ''.join(filter(lambda c: c in string.hexdigits, hex_data))
def decrypt_hex_payload(hex_string):
try:
compressed_bytes = bytes.fromhex(hex_string)
decrypted_bytes = zlib.decompress(compressed_bytes)
return decrypted_bytes.decode()
except Exception as e:
print(f"Gagal mendekripsi: {e}")
exit()
def save_file(path, content):
try:
with open(path, "w") as f:
f.write("# Obfuscate by Vindra Ganzz\n\n")
f.write(content)
except Exception as e:
print(f"Gagal menyimpan file {path}: {e}")
def delete_file(path):
try:
os.remove(path)
print(f"File sementara '{path}' dihapus.")
except Exception as e:
print(f"Gagal menghapus file: {e}")
def main():
source_file = input("[>] Masukan File : ")
output_obf = input(" [>] Output File : ")
output_decrypted = input("[>] Output Decrypt File : ")
# Step 1: Baca source
source_code = read_source_code(source_file)
# Step 2: Obfuscate
obfuscated_code = obfuscate_code(source_code)
save_file(output_obf, obfuscated_code)
print(f"File Hasil Berhasil di Encrypt: {output_obf}")
# Step 3: Decrypt hex
hex_string = extract_hex_payload(obfuscated_code)
decrypted_code = decrypt_hex_payload(hex_string)
save_file(output_decrypted, decrypted_code)
print(f"File Hasil Decryprt: {output_decrypted}")
# Step 4: Hapus file sementara
# delete_file(output_obf)
if __name__ == "__main__":
main()