Author Topic: Script Obfuscater  (Read 4640 times)

0 Members and 1 Guest are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Script Obfuscater
« 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:


Obfuscation of the standardish Explode function:


And Finally a chunk of my private zrpgevolved script:
Its rather large, so im just going to link it. Clickie

Version 1.0.0

Download: From my Dropbox (zip format)

Feedback, suggestions, and criticism please.


Offline Polifen

  • Soldier
  • **
  • Posts: 127
Re: Script Obfuscater
« Reply #1 on: February 09, 2011, 04:04:58 am »
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.

DarkCrusade

  • Guest
Re: Script Obfuscater
« Reply #2 on: February 09, 2011, 09:32:20 am »
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

Offline thegrandmaster

  • Flagrunner
  • ****
  • Posts: 543
    • Grandy on Steam
Re: Script Obfuscater
« Reply #3 on: February 09, 2011, 09:43:58 am »
where would this be used?
ohgodwhydidInamemyselfthis. Just call me Grandy.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script Obfuscater
« Reply #4 on: February 09, 2011, 10:00:19 am »
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 :)
« Last Edit: February 09, 2011, 10:03:03 am by DorkeyDear »

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script Obfuscater
« Reply #5 on: February 09, 2011, 10:51:39 am »
Actually most of the scripts these days are completely unreadable without any obfuscation. ;D
So you should write a tool with opposite purpose...

Offline Polifen

  • Soldier
  • **
  • Posts: 127
Re: Script Obfuscater
« Reply #6 on: February 09, 2011, 01:04:57 pm »
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 :
Code: [Select]
var
ID : byte;
begin
ID:=12;
end;
to:
Code: [Select]
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.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5036
Re: Script Obfuscater
« Reply #7 on: February 09, 2011, 04:48:10 pm »
This is just simple minification, not obfusication.

Still interesting though.
There are other worlds than these

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Script Obfuscater
« Reply #8 on: February 10, 2011, 12:24:03 am »
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.

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Script Obfuscater
« Reply #9 on: February 10, 2011, 11:25:01 pm »
Might make a simple tool to help de-obfuscate code.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs