from core.obfuscator import obfuscate import re test_cases = [ """ local a = 10 print(a) """, """ game:GetService("Players").LocalPlayer:Kick("Test") """, """ return 123 """, """ x = 5 x = x + 1 print(x) """, """ local t = {a = 1} t.a = 2 print(t.a) """ ] def check_syntax(lua_code): # Basic check for balanced quotes and parens in the generated code # Also check for the specific patterns we fixed if "''" in lua_code and "(''" not in lua_code: # Check for the fixed inst_b64 part # Note: ('' is fine for DEC function call if it was meant to be that, but we changed it to (') pass # Check for "task and task.spawn or spawn(" without surrounding parens # Our fix: (task and task.spawn or spawn)(... if "task and task.spawn or spawn(" in lua_code: if "(task and task.spawn or spawn)(" not in lua_code: return False, "Missing parentheses around SPW" # Check for empty string (failed obfuscation) if not lua_code.strip(): return False, "Empty output" # Check for error comments if "-- Obfuscation Error" in lua_code: return False, "Obfuscation Error detected" return True, "OK" for i, code in enumerate(test_cases): obfuscated = obfuscate(code) success, msg = check_syntax(obfuscated) print(f"Test {i}: {success} - {msg}") if not success: print(f"Code: {code}") print(f"Obfuscated snippet: {obfuscated[:200]}...")