zeusssz / hercules-obfuscator

A powerful Lua obfuscator designed to make your Lua code nearly impossible to reverse-engineer, with multiple layers of advanced obfuscation techniques
Apache License 2.0
22 stars 10 forks source link

Issues with local functions #18

Open iwarp opened 2 days ago

iwarp commented 2 days ago

Wanted to try this out on some of my LUA scripts but having issues with it outputting correctly have replicated it with something as simple as this code below.

local function fibonacci(n)
    local a, b = 0, 1
    for i = 1, n do
        print("Fibonacci " .. i .. " is " .. a)
        a, b = b, a + b
    end
end

fibonacci(50)
print("end")

Running this command lua ./hercules.lua ../test.lua

Then running lua ../test_obfuscated.lua it hangs and i don't get the print end, when using local functions, but its fine when its a global function.

Also, it Intermittently crashes every 1/4 runs

lua: ...reter/LuaInterpreter/Parser/SyntaxParsers/Statements.lua:187: Expected an identifier, got: { [TYPE] = Number [Line] = 1 [Value] = 1 } stack traceback: [C]: in function 'assert' ...reter/LuaInterpreter/Parser/SyntaxParsers/Statements.lua:187: in function 'Interpreter/LuaInterpreter/Parser/SyntaxParsers/Statements.consumeMultipleIdentifiers' ...rpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.lua:80: in function 'Interpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.local' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:134: in method 'getNextNode' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:151: in method 'consumeCodeBlock' ...rpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.lua:108: in function 'Interpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.if' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:134: in method 'getNextNode' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:151: in method 'consumeCodeBlock' ...rpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.lua:203: in function 'Interpreter/LuaInterpreter/Parser/SyntaxParsers/Keywords.for' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:134: in method 'getNextNode' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:151: in method 'consumeCodeBlock' ...reter/LuaInterpreter/Parser/SyntaxParsers/Statements.lua:329: in function 'Interpreter/LuaInterpreter/Parser/SyntaxParsers/Statements.consumeLocalFunction' (...tail calls...) ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:134: in method 'getNextNode' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:151: in method 'consumeCodeBlock' ...../Compiler/Interpreter/LuaInterpreter/Parser/Parser.lua:188: in method 'parse' ./modules/Compiler/../Compiler/api.lua:59: in field 'ConvertToAST' ./modules/Compiler/../Compiler/api.lua:159: in function <./modules/Compiler/../Compiler/api.lua:156> (...tail calls...) ./pipeline.lua:58: in function 'pipeline.process' ./hercules.lua:278: in main chunk [C]: in ?

zeusssz commented 1 day ago

can you send me the obfuscated file that messed up with the local func? the 1/4 crash chance is being worked on

zeusssz commented 1 day ago

alright, ive been able to replicate this issue. looking into it