Protect your ActionScript with Amayeta’s SWF Encrypt
Ok... you made it... you made the Flash game that will kick asses and you are sure nobody knows Actionscript like you. Nobody will clone your game because you know ActionScript better than the rest.
If you really know ActionScript, you should now that even if SWF files are compiled, they can be easily decompiled with a lot of softwares available on the net. Just Google for Flash Decompiler to see the most famous ones.
This means that once you published your file, everybody can do reverse engineering on your file and know how did you coded it.
And even if bigger projects are hard to understand, someone may decompile your game, change your logo with another one and submit it in all portals before you do it.
If you think people won't waste their time decompiling your game, you are wrong. They will do it... maybe to hack your highscores, or maybe to put their name in the credits and show their friends what a cool game they made... for a reason or for another, they will do it.
That's when Amayeta comes in our help with its SWF Encrypt. Available both for Windos and Mac OSX encrypts your Adobe Flash SWF files, protecting them from the most popular Flash Decompiler Tools on the market.
Sounds good... here I am for a test drive...
Amayeta's SWF Encrypt (ASWFE from now on) takes less than 5MB on your hard drive, and once you lauch it you will see this screen:

ASWFE shows your unprotected SWF files with a red background and the protected ones with a green background.
In the bottom window you can preview the movie you currently selected. As you can see, I am trying to protect my prototype of Metro Siberia Underground game.
Now just press Encrypt File(s) and you will find a SWF file with the _secure suffix. In my case, the original file was 1butt3.swf, and the new one is 1butt3_secure.swf. Please notice that I did not change any option, and I don't play with strange setups. ASWFE works very well with default options, and all you have to do is pressing a button.
But the final question is: will it work? I tried to decompile 1butt3.swf, the unprotected file, and that's what I got:
-
// Action script...
-
-
// [Action in Frame 1]
-
var ship_filter = new flash.filters.GlowFilter(65280, 8.000000E-001, 4, 4, 2, 3, false, false);
-
var smoke_filter = new flash.filters.GlowFilter(16711680, 8.000000E-001, 4, 4, 2, 3, false, false);
-
var tunnel_filter = new flash.filters.GlowFilter(16776960, 8.000000E-001, 4, 4, 2, 3, false, false);
-
var fuel_filter = new flash.filters.GlowFilter(65535, 8.000000E-001, 4, 4, 2, 3, false, false);
-
var rock_filter = new flash.filters.GlowFilter(16777215, 8.000000E-001, 4, 4, 2, 3, false, false);
-
var score_filter = new flash.filters.GlowFilter(16711935, 8.000000E-001, 2, 4, 2, 3, false, false);
-
gravity = 1.000000E-001;
-
thrust = 2.500000E-001;
-
yspeed = 0;
-
xspeed = 5;
-
distance = 0;
-
smoke_interval = 10000;
-
frames_passed = 0;
-
tunnel_height = 150;
-
fuel_freq = 10;
-
gasoline = 500;
-
rock_freq = 50;
-
engines = false;
-
_root.attachMovie("ship", "ship", _root.getNextHighestDepth(), {_x: 150, _y: 200});
-
_root.createEmptyMovieClip("fuel_movie", _root.getNextHighestDepth());
-
_root.createEmptyMovieClip("deadly_movie", _root.getNextHighestDepth());
-
_root.attachMovie("score", "score", _root.getNextHighestDepth());
-
ship.filters = new Array(ship_filter);
-
score.filters = new Array(score_filter);
-
ship.onEnterFrame = function ()
-
{
-
score.sc.text = "Distance: " + distance + " - " + "Fuel: " + gasoline;
-
if (gasoline> 0 && engines)
-
{
-
yspeed = yspeed - thrust;
-
smoke_interval = smoke_interval - 2.500000E-001;
-
gasoline = gasoline - 1;
-
} // end if
-
if (Math.random() * 1000 <fuel_freq)
-
{
-
fuel = fuel_movie.attachMovie("fuel", "fuel" + fuel_movie.getNextHighestDepth(), fuel_movie.getNextHighestDepth(), {_x: 510, _y: Math.random() * 400 + 50});
-
fuel.filters = new Array(fuel_filter);
-
fuel.onEnterFrame = function ()
-
{
-
this._x = this._x - xspeed * 1.200000E+000;
-
dist_x = ship._x + 28 * Math.cos(angle) - this._x;
-
dist_y = ship._y + 28 * Math.sin(angle) - this._y;
-
dist = Math.sqrt(dist_x * dist_x + dist_y * dist_y);
-
if (dist <10)
-
{
-
gasoline = gasoline + 100;
-
this.removeMovieClip();
-
} // end if
-
if (this._x <-10)
-
{
-
this.removeMovieClip();
-
} // end if
-
};
-
} // end if
-
if (Math.random() * 1000 <rock_freq)
-
{
-
rock = deadly_movie.attachMovie("rock", "rock" + deadly_movie.getNextHighestDepth(), deadly_movie.getNextHighestDepth(), {_x: 510, _y: Math.random() * 400 + 50, _rotation: Math.random() * 360});
-
rock.filters = new Array(rock_filter);
-
rock.onEnterFrame = function ()
-
{
-
this._x = this._x - xspeed;
-
if (this._x <-10)
-
{
-
this.removeMovieClip();
-
} // end if
-
};
-
} // end if
-
yspeed = yspeed + gravity;
-
this._y = this._y + yspeed;
-
angle = Math.atan2(yspeed, xspeed);
-
this._rotation = angle * 180 / 3.141593E+000;
-
++frames_passed;
-
distance = distance + xspeed;
-
if (frames_passed>= smoke_interval)
-
{
-
sm = _root.attachMovie("smoke", "smoke" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x: this._x - 2, _y: this._y});
-
sm.filters = new Array(smoke_filter);
-
sm.onEnterFrame = function ()
-
{
-
this._x = this._x - xspeed;
-
this._width = this._width + 2.000000E-001;
-
this._height = this._height + 2.000000E-001;
-
this._alpha = this._alpha - 2;
-
if (this._alpha <= 0)
-
{
-
this.removeMovieClip();
-
} // end if
-
};
-
frames_passed = 0;
-
} // end if
-
if (this._y> 400 || this._y <0 || deadly_movie.hitTest(this._x + 28 * Math.cos(angle), this._y + 28 * Math.sin(angle), true) || deadly_movie.hitTest(this._x + 8 * Math.cos(angle + 1.570796E+000), this._y + 8 * Math.sin(angle + 1.570796E+000), true) || deadly_movie.hitTest(this._x + 8 * Math.cos(angle - 1.570796E+000), this._y + 8 * Math.sin(angle - 1.570796E+000), true))
-
{
-
yspeed = 0;
-
this._y = 200;
-
gasoline = 500;
-
distance = 0;
-
deadly_movie.removeMovieClip();
-
fuel_movie.removeMovieClip();
-
_root.createEmptyMovieClip("fuel_movie", _root.getNextHighestDepth());
-
_root.createEmptyMovieClip("deadly_movie", _root.getNextHighestDepth());
-
} // end if
-
};
-
_root.onMouseDown = function ()
-
{
-
engines = true;
-
smoke_interval = 10;
-
};
-
_root.onMouseUp = function ()
-
{
-
engines = false;
-
smoke_interval = 100000;
-
};
It changed some logical operators (or with ||) and made some minor changes, but the code is perfectly readable.
Now, let's decompile the protected file:
-
// Action script...
-
-
// [Action in Frame 1]
-
function ()
-
{
-
\x03 = 2568 % 511 * 5;
-
return (eval("\x03"));
-
} // End of the function
-
var \x01 = 439 + \x04\x05();
-
for (\x01 = eval("\x01") - 372; eval("\x01") == 590; \x01 = eval("\x01") + 140)
-
{
-
} // end of for
-
if (eval("\x01") == 933)
-
{
-
\x01 = eval("\x01") - 21;
-
-
}
-
else
-
{
-
\x01 = eval("\x01") - 51;
-
var null = true;
-
if (eval("\x01") == 810)
-
{
-
\x01 = eval("\x01") + 123;
-
-
} // end if
-
if (eval("\x01") == 636)
-
{
-
\x01 = eval("\x01") - 46;
-
-
-
} // end if
-
if (eval("\x01") == 132)
-
{
-
\x01 = eval("\x01") + 504;
-
if (!null)
-
{
-
}
-
else
-
{
-
\x01 = eval("\x01") - 46;
-
} // end else if
-
-
} // end if
-
if (eval("\x01") == 594)
-
{
-
\x01 = eval("\x01") - 8;
-
-
} // end if
-
if (eval("\x01") == 872)
-
{
-
\x01 = eval("\x01") - 142;
-
-
} // end if
-
if (eval("\x01") == 96)
-
{
-
\x01 = eval("\x01") + 714;
-
if (!null)
-
{
-
}
-
else
-
{
-
\x01 = eval("\x01") + 123;
-
} // end else if
-
-
} // end if
-
\x01 = eval("\x01") + 223;
-
if (eval("\x01") == 116)
-
{
-
\x01 = eval("\x01") - 20;
-
-
} // end if
-
if (eval("\x01") == 687)
-
{
-
\x01 = eval("\x01") - 571;
-
-
} // end if
-
if (eval("\x01") == 953)
-
{
-
\x01 = eval("\x01") - 574;
-
if (true)
-
{
-
}
-
else
-
{
-
\x01 = eval("\x01") + 319;
-
} // end else if
-
-
} // end if
-
if (eval("\x01") == 912)
-
{
-
\x01 = eval("\x01") - 912;
-
-
} // end if
-
\x01 = eval("\x01") - 199;
-
if (eval("\x01") == 379)
-
{
-
\x01 = eval("\x01") + 319;
-
-
-
} // end if
-
if (eval("\x01") == 698)
-
{
-
\x01 = eval("\x01") - 112;
-
-
} // end if
-
\x01 = eval("\x01") + 351;
-
-
} // end else if
What a mess! The script s full of strange variables and if you try to execute it in Flash, it will produce tons of errors.
The script is definitively unreadable.
Try before buy
You can download a trial version limited to 15 encryptions and displaying a watermark on your file (useless if you publish your work in the web, useful if you submit a game to Flash Game License) or buy it at $125. If you want to get serious in ActionScript development, you need to protect your work, and at the moment ASWFE is the perfect solution.
They can be easily customized to meet the unique requirements of your project.
19 Responses to “Protect your ActionScript with Amayeta’s SWF Encrypt”
Leave a Reply
Trackbacks
-
Experiment: monetizing a Flash game - Part 8 : Emanuele Feronato - italian geek and PROgrammer on
March 4th, 2008 7:12 pm
[...] (I’ll write a tutorial about it next days) and encrypt it with a software like Amayeta’s SWF Encrypt. The software costs $125, that’s less than 10% of a single interesting sponsorship, and you [...]
Posts
- Rick Triqui: my first PlayCrafter game
- Prototype of a Flash game like Meeblings
- Games for the game developers!
- The art of debugging
- How to embed a text file in Flash
- Create a Flash game in minutes with PlayCrafter
- Upgrade your Flash CS4 to 10.0.2
- Play Mazeroll, my latest Box2D game
- Triqui MochiAds Arcade plugin for WordPress Released!!
- The MochiAds funnel
- Flash game creation tutorial - part 1
- Create a Lightbox effect only with CSS - no javascript needed
- Flash game creation tutorial - part 2
- Make a Flash game like Flash Element Tower Defense - Part 2
- Flash game creation tutorial - part 3
- Create a flash draw game like Line Rider or others - part 1
- Create a Flash Racing Game Tutorial
- Make a Flash game like Flash Element Tower Defense - Part 1
- Create a flash artillery game - step 1
- Create a flash draw game like Line Rider or others - part 5
- Flash game creation tutorial – part 5.2




(4.9 out of 5) - Flash game creation tutorial – part 3




(4.86 out of 5) - Creation of a platform game with Flash – step 2




(4.84 out of 5) - Create a survival horror game in Flash tutorial – part 1




(4.82 out of 5) - Create a flash artillery game – step 1




(4.82 out of 5) - Create a Flash Racing Game Tutorial




(4.8 out of 5) - Create a flash artillery game – step 2




(4.75 out of 5) - New tile based platform engine – part 6 – ladders




(4.74 out of 5) - Flash game creation tutorial – part 2




(4.73 out of 5) - The experiment – one year later




(4.7 out of 5)


It’s not totally fool proof, but it’s pretty good. It uses unprintable characters and other things to trick most decompilers. The decompilers usually get updates in 3-6 months so eventually someone will be able to decompile it, but they will have fairly untidy code with weird names for variables and functions (but still usable).
The most important things for protecting your code with obfuscation are
identifier renaming (turns smoke_interval into h8I9we0U)
and
string encryption (turns all text in “” to encrypted versions)
both of these make it hard to read decompiled code. Not impossible, just hard.
A good place to read about this stuff is ASVGuy’s blog http://www.asvguy.com/2007/02/swf_encrypt_swc.html
this is good if you’re better game/animationmaker and want to sell ur creations to somewhere!
Hey Emanuele, would you have time to do an interview (with email)
i’d like that and that would be great addition to my schoolproject about flash.
is there a email i can send the questions (if this is even okay with you…..) or can you see mine (”E-mail (will not be published) (required)”)
or i say my email out loud here?
why 125$ for an encrytion program?
I know I defenitely won’t spend that much…
Emanuele, check your email. I sent you the mega roll swf. I would really appreciate it if you could publish it.
$125 is a lot if, as Livesinabox says, will be outdated in a few months. I’m surprised Adobe/Macromedia haven’t implemented an Actionscript code to stop people decompiling SWFs.
That’s why you should download the trial and send 15 games to flashgamelicense.
With 15 games sponsored, it won’t be a problem purchasing the original :)
Isn’t there any free similar program? I’m poor…
Continuation:
Look this link…
http://www.hallpass.com/developers/api.html
Hall Pass is offering 50 dollars for games with their API… But they don’t explain how… Well, not easily enogh to me to understand… Can you do a tutorial?
I tried to use Hallpass highscores API but I never got paid, and the game seems not to send any score to hallpass server.
Maybe I made something wrong… I’ll try the luck again with my next game
But can you explain what should i do?
And one more thing… Your RSS Feed contais errors… I can’t see it…
$125 is good value, it would be cheap at twice the price. See how long it would take you to obfuscate your code thoroughly yourself.
People are always mewling about wanting stuff for free, perhaps you’ll find a free software to go along with your free food, free car, free house.. You’ll find out when you leave highschool life doesn’t work like that.
I have used it for a few SWFs and it work very nice!
I may buy it as soon as posible!
I didn’t think that encryption was necessary until I visited a very nasty site where almost every game was ripped to some degree. From complete re-branding to the “more games” link.
Since Boxhead Zombie Wars has been released, the new Amayeta with AS3 should be out soon. I doubt that it will be a free upgrade, so I think I’ll hold off on buying until it comes out. It better be backwards compatible, though.
Flasher, what is the website’s name?
Nice tutorial. But unfortunately, the tool doesn’t work for actionscript 3. But I just found another tool named ‘irrfuscator’, it works quite similar.
I recommend Kindisoft’s secureSWF ($99, $200, $400). It gives far more control and more methods of protection.
http://www.kindisoft.com
Agreed with the above comment. secureSWF encryption gives a lot more control than SWF Encrypt. From my tests… it’s far superior to swf encrypt.