Spaces:
Sleeping
Sleeping
Update uabe_packer.py
Browse files- uabe_packer.py +35 -31
uabe_packer.py
CHANGED
|
@@ -2,8 +2,8 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import UnityPy
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
print("π [UABE PACKER] Memulai operasi
|
| 7 |
|
| 8 |
dummy_path = dummy_dir
|
| 9 |
if os.path.isdir(dummy_dir):
|
|
@@ -15,53 +15,57 @@ def transplant_organs(dummy_dir, target_dir):
|
|
| 15 |
files = os.listdir(target_dir)
|
| 16 |
if files: target_path = os.path.join(target_dir, files[0])
|
| 17 |
|
| 18 |
-
print(f"π¦ Load
|
| 19 |
env_dummy = UnityPy.load(dummy_path)
|
| 20 |
|
| 21 |
print(f"π― Load Brankas Raksasa: {target_path}")
|
| 22 |
env_target = UnityPy.load(target_path)
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
print("βοΈ [UABE PACKER] Mengeksekusi kompresi LZ4 modern
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
# Timpa file Brankas Dummy yang asli dengan versi yang sudah disuntik
|
| 50 |
with open(dummy_path, "wb") as f:
|
| 51 |
f.write(packed_data)
|
| 52 |
|
| 53 |
-
print("β
[UABE PACKER]
|
| 54 |
|
| 55 |
if __name__ == "__main__":
|
| 56 |
if len(sys.argv) < 3:
|
| 57 |
print("β Error: Parameter kurang. Gunakan: python3 uabe_packer.py <dummy_dir> <target_dir>")
|
| 58 |
sys.exit(1)
|
| 59 |
|
| 60 |
-
dummy_arg = sys.argv[1]
|
| 61 |
-
target_arg = sys.argv[2]
|
| 62 |
-
|
| 63 |
try:
|
| 64 |
-
|
| 65 |
except Exception as e:
|
| 66 |
print(f"π₯ [FATAL ERROR] UABE Packer Crash: {str(e)}")
|
| 67 |
import traceback
|
|
|
|
| 2 |
import sys
|
| 3 |
import UnityPy
|
| 4 |
|
| 5 |
+
def replace_cab_and_pack(dummy_dir, target_dir):
|
| 6 |
+
print("π [UABE PACKER] Memulai operasi Brankas Hybrid...")
|
| 7 |
|
| 8 |
dummy_path = dummy_dir
|
| 9 |
if os.path.isdir(dummy_dir):
|
|
|
|
| 15 |
files = os.listdir(target_dir)
|
| 16 |
if files: target_path = os.path.join(target_dir, files[0])
|
| 17 |
|
| 18 |
+
print(f"π¦ Load Identitas Dummy : {dummy_path}")
|
| 19 |
env_dummy = UnityPy.load(dummy_path)
|
| 20 |
|
| 21 |
print(f"π― Load Brankas Raksasa: {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 |
+
|
| 30 |
+
# Ambil seluruh Brankas Raksasa, ganti nomor serinya dengan milik Dummy
|
| 31 |
+
env_target.cabs[dummy_cab] = env_target.cabs.pop(target_cab)
|
| 32 |
+
for obj in env_target.objects:
|
| 33 |
+
if hasattr(obj, "assets_file"):
|
| 34 |
+
obj.assets_file.name = dummy_cab
|
| 35 |
|
| 36 |
+
# PATCH NAMA CAB DI DALAM PREFAB (yang sekarang sudah disalin ke folder Dummy)
|
| 37 |
+
parent_dummy_dir = os.path.dirname(dummy_dir)
|
| 38 |
+
for root, dirs, files in os.walk(parent_dummy_dir):
|
| 39 |
+
for file in files:
|
| 40 |
+
if file.endswith(".prefab"):
|
| 41 |
+
filepath = os.path.join(root, file)
|
| 42 |
+
try:
|
| 43 |
+
with open(filepath, "r", encoding="utf-8") as f:
|
| 44 |
+
content = f.read()
|
| 45 |
+
if target_cab in content:
|
| 46 |
+
content = content.replace(target_cab, dummy_cab)
|
| 47 |
+
with open(filepath, "w", encoding="utf-8") as f:
|
| 48 |
+
f.write(content)
|
| 49 |
+
print(f"π Blueprint di-patch otomatis: {file}")
|
| 50 |
+
except Exception:
|
| 51 |
+
pass
|
| 52 |
|
| 53 |
+
print("βοΈ [UABE PACKER] Mengeksekusi kompresi LZ4 modern...")
|
| 54 |
+
# Kita simpan Brankas Raksasa (yang sudah berubah identitas) dan menimpa file Dummy!
|
| 55 |
+
packed_data = env_target.file.save(packer="lz4")
|
| 56 |
|
|
|
|
| 57 |
with open(dummy_path, "wb") as f:
|
| 58 |
f.write(packed_data)
|
| 59 |
|
| 60 |
+
print("β
[UABE PACKER] Injeksi selesai 100%! Bundle siap di-packing.")
|
| 61 |
|
| 62 |
if __name__ == "__main__":
|
| 63 |
if len(sys.argv) < 3:
|
| 64 |
print("β Error: Parameter kurang. Gunakan: python3 uabe_packer.py <dummy_dir> <target_dir>")
|
| 65 |
sys.exit(1)
|
| 66 |
|
|
|
|
|
|
|
|
|
|
| 67 |
try:
|
| 68 |
+
replace_cab_and_pack(sys.argv[1], sys.argv[2])
|
| 69 |
except Exception as e:
|
| 70 |
print(f"π₯ [FATAL ERROR] UABE Packer Crash: {str(e)}")
|
| 71 |
import traceback
|