Obfuscate
doesn't result in a string of alternating commas and digits like you seem to be assuming it does.
It doesn't form any nice pattern, and since Lua doesn't provide a split
method, you won't want to implement it the way you are.
One option is to use the :gmatch
string method as an iterator:
1 | for numerals in code:gmatch( "%d+" ) do |
2 | dCode = dCode .. string.char( tonumber (numerals)) |
While it's not related directly to your question, I would like to point out that doing obfuscation in this form is futile. Since everything has to be piped through some function like Deobfuscate
to run it, whoever wants to discover the original just has to change loadstring
(or whatever other evaluation) to print
.
Successful code obfuscation requires that the code runs as it is, without having to do some post-processing on it.
E.g., consider this:
02 | return b > 0 and u(b - 1 , a * b, u, v) or a; |
06 | return x = = 0 and y or v(y * x,x - 1 , u, v) |
10 | return f(n, (n + 1 ) / (n + 1 ), f, g); |
any idea what e
does? Any idea how it works?