40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
|
|
import os
|
||
|
|
import zipfile
|
||
|
|
import glob
|
||
|
|
|
||
|
|
def main():
|
||
|
|
kra_files = glob.glob("_images/**/*.kra", recursive=True)
|
||
|
|
print(f"Found KRA files: {kra_files}")
|
||
|
|
|
||
|
|
keys = [
|
||
|
|
b"DrSh", b"IrSh", b"OrGl", b"IrGl", b"ebbl", b"FrFX", b"SoFi", b"GrFl", b"PtFl", b"Scl ", b"lagl", b"Dstn", b"blur", b"Ckmt", b"Opct", b"Md ", b"Clr ", b"Sz "
|
||
|
|
]
|
||
|
|
|
||
|
|
for kra_path in kra_files:
|
||
|
|
print(f"\n--- Analyzing {kra_path} ---")
|
||
|
|
try:
|
||
|
|
with zipfile.ZipFile(kra_path, 'r') as base_zip:
|
||
|
|
asl_paths = [name for name in base_zip.namelist() if name.endswith("layerstyles.asl")]
|
||
|
|
if not asl_paths:
|
||
|
|
print(" No layerstyles.asl found.")
|
||
|
|
continue
|
||
|
|
for asl_path in asl_paths:
|
||
|
|
asl_data = base_zip.read(asl_path)
|
||
|
|
print(f" ASL path: {asl_path} ({len(asl_data)} bytes)")
|
||
|
|
for key in keys:
|
||
|
|
pos = 0
|
||
|
|
found = []
|
||
|
|
while True:
|
||
|
|
idx = asl_data.find(key, pos)
|
||
|
|
if idx == -1:
|
||
|
|
break
|
||
|
|
found.append(idx)
|
||
|
|
pos = idx + len(key)
|
||
|
|
if found:
|
||
|
|
print(f" Key {key.decode('ascii', errors='replace')} found at offsets: {found}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f" Error: {e}")
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|