Spaces:
Sleeping
Sleeping
Update uabe_packer.py
Browse files- uabe_packer.py +23 -17
uabe_packer.py
CHANGED
|
@@ -3,9 +3,8 @@ import sys
|
|
| 3 |
import UnityPy
|
| 4 |
|
| 5 |
def extract_and_inject(dummy_dir, target_dir):
|
| 6 |
-
print("π [UABE PACKER] Memulai proses Injeksi Biner...")
|
| 7 |
|
| 8 |
-
# 1. Menangani Path (Hugging Face Node.js biasanya memberikan path folder)
|
| 9 |
dummy_path = dummy_dir
|
| 10 |
if os.path.isdir(dummy_dir):
|
| 11 |
files = os.listdir(dummy_dir)
|
|
@@ -22,39 +21,46 @@ def extract_and_inject(dummy_dir, target_dir):
|
|
| 22 |
print(f"π― Load Target: {target_path}")
|
| 23 |
env_target = UnityPy.load(target_path)
|
| 24 |
|
| 25 |
-
# ====================================================================
|
| 26 |
-
# --- LOGIKA INJEKSI ZEPETO ---
|
| 27 |
-
# Memindahkan isi Target ke dalam Wadah Dummy untuk mengelabui server
|
| 28 |
-
# ====================================================================
|
| 29 |
-
|
| 30 |
-
# Mengambil nama internal (CAB) asli dari dummy
|
| 31 |
dummy_cab = list(env_dummy.cabs.keys())[0] if env_dummy.cabs else None
|
| 32 |
target_cab = list(env_target.cabs.keys())[0] if env_target.cabs else None
|
| 33 |
|
| 34 |
-
# Mengubah identitas biner target agar persis seperti dummy
|
| 35 |
if dummy_cab and target_cab and dummy_cab != target_cab:
|
|
|
|
| 36 |
env_target.cabs[dummy_cab] = env_target.cabs.pop(target_cab)
|
| 37 |
for obj in env_target.objects:
|
| 38 |
if hasattr(obj, "assets_file"):
|
| 39 |
obj.assets_file.name = dummy_cab
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
print("βοΈ [UABE PACKER] Mengeksekusi kompresi LZ4 modern...")
|
| 47 |
-
|
| 48 |
packed_data = env_target.file.save(packer="lz4")
|
| 49 |
|
| 50 |
-
# Menimpa file dummy asli dengan biner yang sudah diinjeksi
|
| 51 |
with open(dummy_path, "wb") as f:
|
| 52 |
f.write(packed_data)
|
| 53 |
|
| 54 |
print("β
[UABE PACKER] Injeksi selesai 100%! Bundle siap di-packing.")
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|
| 57 |
-
# Verifikasi Argumen Terminal
|
| 58 |
if len(sys.argv) < 3:
|
| 59 |
print("β Error: Parameter kurang. Gunakan: python3 uabe_packer.py <dummy_dir> <target_dir>")
|
| 60 |
sys.exit(1)
|
|
|
|
| 3 |
import UnityPy
|
| 4 |
|
| 5 |
def extract_and_inject(dummy_dir, target_dir):
|
| 6 |
+
print("π [UABE PACKER] Memulai proses Injeksi Biner & Blueprint...")
|
| 7 |
|
|
|
|
| 8 |
dummy_path = dummy_dir
|
| 9 |
if os.path.isdir(dummy_dir):
|
| 10 |
files = os.listdir(dummy_dir)
|
|
|
|
| 21 |
print(f"π― Load Target: {target_path}")
|
| 22 |
env_target = UnityPy.load(target_path)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
dummy_cab = list(env_dummy.cabs.keys())[0] if env_dummy.cabs else None
|
| 25 |
target_cab = list(env_target.cabs.keys())[0] if env_target.cabs else None
|
| 26 |
|
|
|
|
| 27 |
if dummy_cab and target_cab and dummy_cab != target_cab:
|
| 28 |
+
print(f"π Mengganti Identitas Biner: {target_cab} -> {dummy_cab}")
|
| 29 |
env_target.cabs[dummy_cab] = env_target.cabs.pop(target_cab)
|
| 30 |
for obj in env_target.objects:
|
| 31 |
if hasattr(obj, "assets_file"):
|
| 32 |
obj.assets_file.name = dummy_cab
|
| 33 |
|
| 34 |
+
# ====================================================================
|
| 35 |
+
# --- PERBAIKAN MUTLAK: INJEKSI BLUEPRINT (PREFAB PATCHER) ---
|
| 36 |
+
# Mencari file .prefab raksasa di luar folder assetbundles dan
|
| 37 |
+
# mengubah catatan alamatnya agar menunjuk ke CAB Dummy.
|
| 38 |
+
# ====================================================================
|
| 39 |
+
parent_dummy_dir = os.path.dirname(dummy_dir)
|
| 40 |
+
for root, dirs, files in os.walk(parent_dummy_dir):
|
| 41 |
+
for file in files:
|
| 42 |
+
if file.endswith(".prefab") or file.endswith(".meta") or file.endswith(".asset"):
|
| 43 |
+
filepath = os.path.join(root, file)
|
| 44 |
+
try:
|
| 45 |
+
with open(filepath, "r", encoding="utf-8") as f:
|
| 46 |
+
content = f.read()
|
| 47 |
+
if target_cab in content:
|
| 48 |
+
content = content.replace(target_cab, dummy_cab)
|
| 49 |
+
with open(filepath, "w", encoding="utf-8") as f:
|
| 50 |
+
f.write(content)
|
| 51 |
+
print(f"π Blueprint di-patch otomatis: {file}")
|
| 52 |
+
except Exception:
|
| 53 |
+
pass # Abaikan jika file merupakan format binary
|
| 54 |
+
|
| 55 |
print("βοΈ [UABE PACKER] Mengeksekusi kompresi LZ4 modern...")
|
|
|
|
| 56 |
packed_data = env_target.file.save(packer="lz4")
|
| 57 |
|
|
|
|
| 58 |
with open(dummy_path, "wb") as f:
|
| 59 |
f.write(packed_data)
|
| 60 |
|
| 61 |
print("β
[UABE PACKER] Injeksi selesai 100%! Bundle siap di-packing.")
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
|
|
|
| 64 |
if len(sys.argv) < 3:
|
| 65 |
print("β Error: Parameter kurang. Gunakan: python3 uabe_packer.py <dummy_dir> <target_dir>")
|
| 66 |
sys.exit(1)
|