package
{
import com.adobe.crypto.SHA2;
import com.xtar.amfx.AmfxFactory;
import flash.display.Sprite;
import flash.utils.ByteArray;
import flash.utils.Dictionary;
import utility.CrackHelper;
import sockets.CrackRequest;
import sockets.GameServer;
import sockets.SocketEvent;
public class crack extends Sprite
{
public static var diff:Dictionary = new Dictionary;
public static var idx:Dictionary = new Dictionary;
public function crack()
{
AmfxFactory.registerClassAlias("CrackRequestActionBody", CrackRequest);
GameServer.initialize();
GameServer.getInstance().addEventListener(SocketEvent.CONNECTED, loadDiff);
GameServer.connect("192.168.203.128",7999);
loadDiff();
}
private function loadDiff(e:* = null):void
{
CrackHelper.loadData('../2013090916..2013090918', function(path:String, data:ByteArray):void
{
parseIndex(data, diff);
loadIdx();
});
}
private function loadIdx():void
{
CrackHelper.loadData('../2013090916', function(path:String, data:ByteArray):void
{
parseIndex(data, idx);
loadAssets();
});
}
private function loadAssets():void
{
//trace(SHA2.hash('/emotion'));
//trace(SHA2.hash('client//emotion'));
//trace(SHA2.hash('client/emotion'));
//trace(SHA2.hash('./client/emotion'));
//trace(SHA2.hash('/client/emotion'));
//
//trace(SHA2.hash('./client//emotion'));
//trace(SHA2.hash('/client//emotion'));
//trace(SHA2.hash('client/assets/emotion'));
//trace(SHA2.hash('./client/emotion'));
CrackHelper.loadData('../assets.txt', function(path:String, data:ByteArray):void
{
data.uncompress();
var s:String = '';
for each(var line:String in data.readUTFBytes(data.length).split('\n'))
{
var murl:String= '';
var url:String = line.split('|')[0];
url = 'client/assets' + url;
var key:String = SHA2.hash(url).substr(0,10);
if(crack.diff[key])
{
murl = '/file/' + crack.diff[key] + '/' + url.substr((url.lastIndexOf('/')+1));
}
else
{
var _loc_2:* = url.lastIndexOf("/");
var _loc_3:* = _loc_2 <= 0 ? (".") : (url.substring(0, _loc_2));
var _loc_4:* = SHA2.hash(_loc_3).substr(0, 10);
murl = '/file/' + crack.idx[_loc_4] + '/' + url.substr((url.lastIndexOf('/')+1));
}
s += url + '\t' + murl + '\n';
}
CrackHelper.postString('c://svn//assets.crack2.txt', s);
});
}
private static function parseIndex(param1:ByteArray, param2:Object) : void
{
var _loc_6:int = 0;
var _loc_7:String = null;
var _loc_3:Array = [];
var _loc_4:Array = [];
var _loc_5:int = 0;
while (param1.bytesAvailable)
{
_loc_6 = param1.readUnsignedByte();
_loc_7 = _loc_6 < 16 ? ("0" + _loc_6.toString(16)) : (_loc_6.toString(16));
if (++_loc_5 <= 5)
{
_loc_3.push(_loc_7);
}
else
{
_loc_4.push(_loc_7);
}
if (_loc_5 == 25)
{
_loc_5 = 0;
param2[_loc_3.join("")] = _loc_4.join("");
_loc_3.length = 0;
_loc_4.length = 0;
}
}
return;
}// end function
}
}