PDA

View Full Version : scar formatter/obfuscater



sherlockmeister
12-22-2008, 12:03 AM
hello, this is a little project that came into my head even though it had been i long time since i visited the forums. basically it is a scar script source code parser that either just writes the script to a file formatted or transforms it so that all names are replaced with nonsense, statements are all jumbled with labels/jumps, integer literals are obbed, and spacing is messed up. just run from the command line with in path, out path, and flags.
flags are like this:
none means just format
"-n" means mess up names/integers
"-j" means jumble up statements with gotos (also enables "-n")
"-t" means mess up spacing
well, heres and example to clear things up a little:
java Obfuscater "in.scar" "-j" "-t" "out.scar"
or
java Obfuscater "in.scar" "out.scar"
(make sure flags are between in and out path)
just as an example i will post bejeweled.scar (in you scripts\games directory lol) obfuscated with all flags

dont expect this to be completely bug free so you may not always get a compilable output

if you dont know how to run this and you really want to try it out then just post you script

(as you can see the obbed file with all flags is freaking huge so i will post it also without the spacing flag because it takes scar like 20 seconds to compile it)

ok another thing dont compile source file on your desktop!!! you will end up with like 30 separate class files!

Aser
12-22-2008, 12:16 AM
Just wondering, what is the point of this? I also think I'm a little confused... Does it just ruin a script?

A G E N T
12-22-2008, 12:30 AM
Very impressive :) Haven't looked at the source, as I don't have RAR support on this computer, but the output is very nice :)
@Aser, it messes it up, but so that it will still compile in SCAR.

Aser
12-22-2008, 12:56 AM
So wouldn't this make it easier for people to make password stealing scripts? I'm not trying to cut down your work, I'm just trying to get a full understanding of it.

bullzeye95
12-22-2008, 12:56 AM
Ahh, very nice! I love the use of gotos. Makes it really unreadable.

Great job.

EDIT: Aser, it's against the rules to release obfuscated scripts AFAIK.

Timer
12-22-2008, 01:35 AM
EDIT: Aser, it's against the rules to release obfuscated scripts AFAIK.

Since When?

bullzeye95
12-22-2008, 01:45 AM
Ok, maybe I'm crazy...

noidea
12-22-2008, 01:49 AM
I thought Wizzup? was telling us awhile ago about not to release obbed scripts.

bullzeye95
12-22-2008, 02:00 AM
Yeah, probably. I know I saw it somewhere.

senrath
12-22-2008, 02:32 AM
Yeah, probably. I know I saw it somewhere.

I'm pretty sure I saw it somewhere as well, but I haven't been able to find where.

MylesMadness
12-22-2008, 02:48 AM
Since When?Since you posted a obbed script :p

Zyt3x
12-22-2008, 10:14 AM
I tried your obbed bjelwed (the first)

Successfully compiled (23398 ms)
Line 2659: [Warning] (2659:12): Calculation always evaluates to True in script
Line 3941: [Warning] (3941:59): "True and" is not needed in script
Line 4247: [Warning] (4247:1): "True and" is not needed in script
Line 4249: [Warning] (4249:90): "False or" is not needed in script
Line 4253: [Warning] (4253:1): "True and" is not needed in script
Line 4500: [Warning] (4500:10): "False or" is not needed in script
Line 4934: [Warning] (4934:1): "False or" is not needed in script
Line 5089: [Warning] (5089:25): "True and" is not needed in script
Line 5098: [Warning] (5098:1): "False or" is not needed in script
Line 5692: [Warning] (5692:16): Calculation always evaluates to False in script
Line 5697: [Warning] (5697:33): "False or" is not needed in script
Line 5703: [Warning] (5703:10): "True and" is not needed in script
Line 6175: [Warning] (6175:33): Calculation always evaluates to False in script
Line 6370: [Warning] (6370:1): "True and" is not needed in script
Line 6613: [Warning] (6613:52): "False or" is not needed in script
Line 11237: [Warning] (11237:1): "True and" is not needed in script
Line 11243: [Warning] (11243:1): Calculation always evaluates to False in script
Line 11252: [Warning] (11252:9): "False or" is not needed in script
Line 12184: [Warning] (12184:1): "True and" is not needed in script
Line 12193: [Warning] (12193:41): "False or" is not needed in script
Successfully executed

MylesMadness
12-24-2008, 04:53 PM
It makes it take for ever to compile.

Dan Cardin
12-24-2008, 07:02 PM
making it turn the script into one line would further the unreadability.

Yakman
12-24-2008, 08:55 PM
i disagree, all the junk in the script makes it more unreadable then if it was on one line

Dan Cardin
12-25-2008, 03:53 PM
i disagree, all the junk in the script makes it more unreadable then if it was on one line

i was saying, keep it as it is (in the sense of how it changes the script already), and put it all on one line.

Ron
01-04-2009, 12:06 AM
Cool, this a very intricate program. Here's some critique.

If you run the program by itself, it generates a java error. You should have it check for FileNotFoundException.

File someFile = new File( "blah.txt" );
if ( someFile.exists( ) ) // if it exists, continue
...
else
System.err.println( "File was not found." );

Your formatting is off because your java file generated this block:


function replace(thestring, replacee, replacer: string): string;
var
a: longint;
begin
a := pos(replacee, thestring);
if (a > 0) then
begin
delete(thestring, a, length(replacee));
insert(replacer, thestring, a);
end;
result := thestring;
end;


When it should have generated:


function replace(thestring, replacee, replacer: string): string;
var
a: longint;
begin
a := pos(replacee, thestring);
if (a > 0) then
begin
delete(thestring, a, length(replacee));
insert(replacer, thestring, a);
end;
result := thestring;
end;


Also, -t seems to change the spacing AND the names. -n doesn't change the names, it seems that the program just ignores it. and -j doesn't change the names because it turns -n on which doesn't do anything.

Other than that, nice script. It twisted my DFM Parser perfectly and after obbed, the parser was still able to generate compilable scar form code. You have done a fantastic job!

Now it would be nice if you had a GUI. :) I hate using the command line in Windows.

Sandstorm
02-19-2009, 04:40 AM
Anyone who knows how to use this explain it to me? Thanks!

~Sandstorm

Method
02-19-2009, 06:28 AM
Extract it to a location of your choice, compile it using the javac command, then you can run it with one of the lines he provided in the first post.

Sandstorm
02-19-2009, 11:15 PM
Grr, it's not working :/.

Keeps throwing me this error:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings>java Desktop\Obfuscater2.class "C:\Documents a
nd Setting\Desktop\SCAR 3.15\Scripts\NameOfScriptHere" "-j" "-t" "
C:\Documents and Settings\Desktop\SCAR 3.15\Scripts\DLCaver.scar"
Exception in thread "main" java.lang.NoClassDefFoundError: Desktop\Obfuscater2/c
lass
Caused by: java.lang.ClassNotFoundException: Desktop\Obfuscater2.class
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: Desktop\Obfuscater2.class. Program will exit.

C:\Documents and Settings>

As you can tell, this is the command I'm using. It's not working though, and I've tried many ways of telling it where to find Obfuscater2.class :/.

java Desktop\Obfuscater2.class "C:\Documents a
nd Setting\Desktop\SCAR 3.15\Scripts\NameOfScriptHere" "-j" "-t" "
C:\Documents and Settings\Desktop\SCAR 3.15\Scripts\DLCaver.scar"

Any help at all is appreciated!

~Sandstorm

Method
02-19-2009, 11:30 PM
You don't include .class when you are using the javac command. Just do
java Desktop\Obfuscater2 "C:\Documents and Setting\Desktop\SCAR 3.15\Scripts\NameOfScriptHere" "-j" "-t" "C:\Documents and Settings\Desktop\SCAR 3.15\Scripts\DLCaver.scar"
and you should be fine.

Sandstorm
02-19-2009, 11:46 PM
Wtf. I changed it to the right path, and it still tells me the exact same error! Grr....

~Sandstorm

Method
02-19-2009, 11:56 PM
You want to do java Obfuscater2 ... not java Obfuscater2.class. Make sure you're not still doing that. Also make sure you've compiled it with javac.

CamHart
04-01-2009, 07:55 AM
this is really neat

Clishem
04-07-2009, 04:30 PM
Hey there, could someone tell me what an 'obfuscater' is? Is it to protect a script from being de-compiled or something like that?

Method
04-07-2009, 06:57 PM
http://en.wikipedia.org/wiki/Obfuscated_code

That should fill you in.

noidea
05-04-2009, 10:38 AM
:< I read SandStorms posts and I still dont understand what to do.

Blender
05-06-2009, 10:16 AM
Do you have JDK installed?

rpg711
05-15-2009, 04:53 AM
Wouldn't an obfuscator for scarscripts be pointless since most scripts require values to be edited? Just my thoughts... obfuscation normally makes classes/methods/variables all weird n shit.

Yakman
05-15-2009, 07:24 AM
Wouldn't an obfuscator for scarscripts be pointless since most scripts require values to be edited? Just my thoughts... obfuscation normally makes classes/methods/variables all weird n shit.

you can have a scar script with a form

footballjds
05-15-2009, 07:51 AM
2 months and 3 weeks later the fuscated script compiles ;)

noidea
05-15-2009, 08:03 AM
Lol, it changed a 2.5k line script into a 40k lined script.
It takes like 4 minutes to compile.

scuz 10
06-19-2010, 05:31 AM
Any chance this could be updated?

nielsie95
06-19-2010, 08:27 AM
Alternatives:

By Ron (http://villavu.com/forum/showthread.php?t=34366)
By me (http://villavu.com/forum/showthread.php?t=35513)
By mastaraymond (http://villavu.com/forum/showthread.php?t=16711)

scuz 10
06-19-2010, 08:44 AM
Alternatives:

By Ron (http://villavu.com/forum/showthread.php?t=34366)
By me (http://villavu.com/forum/showthread.php?t=35513)
By mastaraymond (http://villavu.com/forum/showthread.php?t=16711)

Yours is the only one that still works. I was hoping to run a script through yours and then through another for added protection. Can you find another working obfuscator? (I've been searching these forums for over an hour and I can't)