SpriteHand
Module Border
  Obfuscating Silverlight (for free)
Module Border
Location: BlogsAndy's Blog    
Posted by: host 4/15/2010 5:39 PM

You might be aware that when you publish a Silverlight XAP on the web, your source code is very vulnerable to prying eyes. A XAP file is in a ZIP compressed format, and the contents are .NET Assemblies and resources which can be disassembled easily using a tool like .NET Reflector . Although there is no sure-fire way to stop someone from copying your Silverlight application logic, obfuscation can at least make it a bit more difficult to hack through.

Babel Obfuscator for .NET

There are a few obfuscators out there that support Silverlight, but they can be pricey. However, Babel Obfuscator started out as a community project and still maintains a freeware edition. Additionally, it appears that the new version of Babel has corrected some issues with obfuscating Silverlight assemblies.

Here is how you can use the free edition of Babel Obfuscator to encrypt your Silverlight assemblies: (I should mention, if you do have $149 laying about, I recommend buying the Pro version of Babel which has XAP support)

1.       Download the Free edition of Babel Obfuscator.

2.       Download the Free 7-zip compression utility. We’ll need this to update the obfuscated assemblies in our Silverlight XAP file. If you are happier with a different ZIP utility, go ahead and use it instead.

3.       Inside your Silverlight solution, right-click the Silverlight project and select Properties.

4.       Go to the “Build Events” tab and add the following inside the Post-build event command line:

"C:\Program Files\Babel\babel.exe" $(TargetPath) --noildasm --nomsil --noinvalidopcodes

"C:\Program Files\7-Zip\7z.exe" a $(TargetDir)$(ProjectName).xap $(TargetDir)BabelOut\$(TargetFileName) -y -tZIP

This post-build event will run the Babel Obfuscator against your assembly, which places it into a “BabelOut” subdirectory. Then we use 7-zip to bring that updated, obfuscated assembly back into our XAP file.

Examining the Obfuscation

We can use a tool like .NET Reflector to see what the obfuscator does for us. Here is some example before-and-after code showing an example of the obfuscation.

BEFORE OBFUSCATION

    private bool IsRagDollPart(string part);
    private void LayoutRoot_KeyDown(object sender, KeyEventArgs e);
    private void LayoutRoot_KeyUp(object sender, KeyEventArgs e);
    private void MainPage_Loaded(object sender, RoutedEventArgs e);
    private void newObstacleExplode_Exploded(ucObstacle source);
    private void newObstacleExplode_Exploding(ucObstacle source);
    private void PositionBalloon(ucObstacle obstacle);
    private void PositionEnemy(FlyingEnemyBase enemy);
    private void PositionPowerUp(PowerupBase powerUp);
    public static double RadiansToDecimalDegrees(double radians);
    private void ResetLevel();
    private void ShieldActive(bool isActive);
    private void ucExplosion1_Exploded(ucExplosion source);
    private void ucMainGame_KeyDown(object sender, KeyEventArgs e);
    private void ucMainGame_KeyUp(object sender, KeyEventArgs e); 

AFTER OBFUSCATION

    private void (bool );
    private bool (string );
    private void (object );
    private void ();   
private
void (PowerupBase );
private void (bool );
    private void (ucObstacle );
    private void (ucExplosion );
    private void ();
    private void (ucObstacle );
    private void (ucObstacle );
    private void (PowerupBase );
    private void (FlyingEnemyBase );
    private void (object , KeyEventArgs );
    private void (object , KeyEventArgs );

 

Permalink |  Trackback

Comments (12)   Add Comment
Re: Obfuscating Silverlight (for free)    By Anonymous on 4/15/2010 7:55 PM
Thank you very much for another Wise Tip Andy.

Regards

KRK

Re: Obfuscating Silverlight (for free)    By Anonymous on 4/16/2010 2:28 AM
There's also Eazfuscator.Net which is free, and very easy to use. Just drag and drop either your assembly or project(see link below).

http://www.foss.kharkov.ua/g1/projects/eazfuscator/dotnet/Default.aspx

Re: Obfuscating Silverlight (for free)    By Anonymous on 4/16/2010 9:35 AM
Deep Sea Obfuscator is a little more pricey but includes physical corruption of the manifest so you need to do a bit more work to get it to work in Reflector.

Re: Obfuscating Silverlight (for free)    By Anonymous on 4/20/2010 12:47 PM
Thanks Andy,

Small change I made was to bable the release code:

IF $(ConfigurationName) == Release "C:\Program Files\Babel\babel.exe" "$(TargetPath)" --noildasm --nomsil --noinvalidopcodes

IF $(ConfigurationName) == Release "C:\Program Files\7-Zip\7z.exe" a "$(TargetDir)$(ProjectName).xap" "$(TargetDir)BabelOut\$(TargetFileName)" -y -tZIP

Marti

Re: Obfuscating Silverlight (for free)    By Anonymous on 5/23/2010 2:34 PM
Hi folks.
CodeFort Free Edition automatically parses your XAML code and excludes exactly those types and members that are referenced. No hassle - and it's perfectly free.
If you want to also obfuscate the types and members that are referenced in the XAML code, you can opt to the Xaml Renaming feature of CodeFort Professional, which is available for $199.
Check it out if you haven't yet done so!
www.codefort.org

Re: Obfuscating Silverlight (for free)    By Anonymous on 9/14/2010 6:24 AM
Too bad none of these free obfuscators work with Windows Phone 7 :(

Re: Obfuscating Silverlight (for free)    By Anonymous on 10/11/2010 5:41 AM
The latest version of Crypto Obfuscator supports Windows Phone 7 including XNA games, XBox games, WP7 apps, etc.

http://www.ssware.com/cryptoobfuscator/obfuscator-net.htm

Re: Obfuscating Silverlight (for free)    By Anonymous on 11/6/2010 12:39 PM
any updates on WP7 obfuscators? (And stop posting links to 200$+ obfuscators)

Re: Obfuscating Silverlight (for free)    By Anonymous on 11/7/2010 5:52 PM
I'm not sure what $200+ links you're referring to? This post links to a free version of Babel obfuscator.

Anyway, I've had OK luck with Babel under WP7. I had to disable controlflow in some cases for it to work though. So the modified Post-build event should look like this:

"C:\Program Files\Babel\babel.exe" $(TargetPath) --nocontrolflow --noildasm --nomsil --noinvalidopcodes

"C:\Program Files\7-Zip\7z.exe" a $(TargetDir)$(ProjectName).xap $(TargetDir)BabelOut\$(TargetFileName) -y -tZIP

-Andy

DotFuscator for WP7 now free    By Anonymous on 12/5/2010 3:12 PM
PreEmptive released their DotFuscator for Windows Phone for free. So just use that.

Re: Obfuscating Silverlight (for free)    By Anonymous on 6/20/2011 2:03 AM
Unfortunately, Babel Obfuscator is not free anymore!

Re: Obfuscating Silverlight (for free)    By Anonymous on 8/21/2012 12:03 AM
CodeFort has been free for a while, It worked well for me: http://codefort.org/download


Title:
Comment:
Add Comment   Cancel 
Module Border Module Border
Module Border
  Subscribe
Module Border
RSS   Twitter
Module Border Module Border
Module Border
  Diversions
Module Border

TALKING RAGDOLL
This Windows Phone 7 App was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!

MORE INFO



DROPPYPOP
This Windows Phone 7 game was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine.
DEMO

MORE INFO



BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight 2, the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight 2.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight 2.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2014 andy.beaulieu.com - Login