Official Soldat Forums
Soldat Fans => Fan Apps => Topic started by: Hacktank on February 08, 2011, 07:17:55 pm
-
Hello, i have written a program that 'obfuscates', essentially encrypts, soldat scripts. While the server can still use them just fine, if not better, they are virtually impossible to decipher for a human. It renames every user-defined variable and function, removes all whitespace, and removes all comments.
Here are a couple of screenshots (only the first one shows the spruced up command-line output)
CLI/Usage example:
(http://img824.imageshack.us/img824/2572/cli2.png)
Obfuscation of the standardish Explode function:
(http://img826.imageshack.us/img826/9503/explodeout.png)
And Finally a chunk of my private zrpgevolved script:
Its rather large, so im just going to link it. Clickie (http://dl.dropbox.com/u/3180075/output.png)
Version 1.0.0
Download: From my Dropbox (http://goo.gl/XGcHi) (zip format)
Feedback, suggestions, and criticism please.
-
Minute in Notepad++ and it should be readable, maybe it won't look clean ( no tabulators, and still most variables will have strange names ) but shouldn't be too hard to read.
-
Minute in Notepad++ and it should be readable, maybe it won't look clean ( no tabulators, and still most variables will have strange names ) but shouldn't be too hard to read.
The point is to make it harder to read. Large scripts will just be impossible to read, due to hundreds of functions without any comments or clue-giving names. Sure, small scripts are still readable, but think bigger :P
-
where would this be used?
-
Awesome!
I noticed some unnecessary spaces that could still be removed without issues (a - b -> a-b, etc.), not that huge of a deal.
I suggest more weird variable names than a, b, c, etc. It might be harder to tell what is what if variable names are all in a format like "_981566" or something, maybe a unique base64-like value after the underscore or something; again, not a huge deal.
Thanks :)
-
Actually most of the scripts these days are completely unreadable without any obfuscation. ;D
So you should write a tool with opposite purpose...
-
Minute in Notepad++ and it should be readable, maybe it won't look clean ( no tabulators, and still most variables will have strange names ) but shouldn't be too hard to read.
The point is to make it harder to read. Large scripts will just be impossible to read, due to hundreds of functions without any comments or clue-giving names. Sure, small scripts are still readable, but think bigger :P
I didn't mean syntax highlighting, but ctrl + f and replace tab, replace ";" with ";\n" and you have a nice new lines ( it's not perfect, but it fixes most new lines ).
@Suggestions, that is totally weird but you could for ex. change :
var
ID : byte;
begin
ID:=12;
end;
to:
var
ID:byte;
begin
ID := 93196;
end;
Byte's range is 0 to 255, so 256 will be treated as 0, so number + random(1, 20) * 256 won't change the number itself.
-
This is just simple minification (http://en.wikipedia.org/wiki/Minification_%28programming%29), not obfusication (http://en.wikipedia.org/wiki/Obfuscated_code).
Still interesting though.
-
Well, like jrgp pointed out it's not a proper obfuscator but gj anyway. I guess it's pretty useless with small scripts but I've tested it with +8k LOC script and indeed lack of comments and clue-giving names makes it way harder to understand (not impossible though).
You could also give up changing names of parameters of predefined procedures (like OnMapChange()) since everyone knows what they're used for.
-
Might make a simple tool to help de-obfuscate code.