标签:
好些国外网站的好玩的小游戏都经过mochicrypt进行了加密,效果就是打开swf会有个小锁,用asv打开swf里面看到的就是几个差不多的内容:
package { import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; import flash.events.Event; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; import flash.system.ApplicationDomain; import flash.system.LoaderContext; import flash.utils.ByteArray; public class PayLoadDe extends Sprite { // private static const VERSION:String="2.3c";//3.2c // private static const VERSION:String="3.2c";//3.2c private static const VERSION:String= "3.1c"; //3.2c // private static const VERSION_ENCODE_CONSTANT:int=16;//32 private static const VERSION_ENCODE_CONSTANT:int=32; //32 private static const SWF_PATH:String="F:/flash-stuff/games/softbody/stuff/" ; private static const SWF_NAME:String= "softbody_d2_7"; private var loader:URLLoader; public function PayLoadDe() { loader= new URLLoader(); loader.dataFormat=URLLoaderDataFormat.BINARY; loader.load( new URLRequest(SWF_PATH+SWF_NAME+ ".bin")); // addChild(loader); loader.addEventListener(Event.COMPLETE, onCompleteHandler); } private function onCompleteHandler(e:Event): void { trace ("load over" ); var S:* = null ; var i:*=0; var j:*=0; var k:*=0; var n:*=0; var u:*=0; var v:*=0; var data:ByteArray=(e.target as URLLoader).data trace (data.length); trace ("data2.length" , data.length); if (data.length > 0){ S = new ByteArray(); n = (data.length - VERSION_ENCODE_CONSTANT); i = 0; while (i < 0x0100) { S.writeByte(i); i = (i + 1); }; j = 0; i = 0; while (i < 0x0100) { j = (((j + S[i]) + data[(n + (i & (VERSION_ENCODE_CONSTANT-1)))]) & 0xFF); u = S[i]; S[i] = S[j]; S[j] = u; i = (i + 1); }; if (n > 131072){ n = 131072; }; var _local2:int; j = _local2; i = _local2; k = 0; while (k < n) { i = ((i + 1) & 0xFF); u = S[i]; j = ((j + u) & 0xFF); v = S[j]; S[i] = v; S[j] = u; data[k] = (data[k] ^ S[((u + v) & 0xFF)]); k = (k + 1); }; data.uncompress(); }; ; var context:LoaderContext= new LoaderContext( false, ApplicationDomain.currentDomain); context.allowCodeImport= true ; // payloadLoader=new Loader(); // addChild(payloadLoader); // payloadLoader.loadBytes(data,context); var file:File= new File(SWF_PATH+SWF_NAME+ "_real.swf"); var fileStream:FileStream= new FileStream(); fileStream.open(file,FileMode.WRITE); fileStream.writeBytes(data); } } }
标签:
原文地址:http://www.cnblogs.com/newjunwei/p/4708934.html