Advertisement
CDLG_TGR

ass3

Jul 4th, 2018
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ;
  2.  
  3. import sys.io.File;
  4. import haxe.io.Bytes;
  5. import haxe.crypto.Md5;
  6.  
  7. class Main
  8. {
  9.     private static inline var KEY:String = "rootmeifyoucan";
  10.     private static inline var FILE:String = "1_RootMe_EmbeddedSWF.bin";
  11.     private static inline var NEW_FILE:String = "2_RootMe_EmbeddedSWF.bin";
  12.    
  13.     private static inline var CODE:String = "dbbcd6ee441aa6d2889e6e3cae6adebe";
  14.     private static inline var FIND:String = "xxxxxxxxxxxx";
  15.  
  16.  
  17.     public static function main()
  18.     {
  19.         var bytes = File.getBytes(FILE);
  20.        
  21.         File.saveBytes(NEW_FILE, XOR(bytes, KEY)); 
  22.  
  23.         Hex.fromArray(MD5.hash(Hex.toArray(Hex.fromString(this._e4G79.split("").reverse().join("")))))
  24.  
  25.         hex_from_array(Md5.make(hex_to_array(hex_from_string("codea12chiffrestopsecreto"))));
  26.         ==
  27.         CODE
  28.     }
  29.  
  30.     static private hex_from_array(bytes:Bytes, param)
  31.  
  32.     static private function XOR(bytes:Bytes, key:String) : Bytes
  33.     {
  34.         var new_bytes = bytes;
  35.         var j = 0;
  36.  
  37.         for(i in 0...bytes.length)
  38.         {
  39.             new_bytes.set(i, (new_bytes.get(i) ^ key.charCodeAt(j)));
  40.  
  41.             j ++;
  42.             if(j >= key.length) j = 0;
  43.         }
  44.  
  45.         return new_bytes;
  46.     }
  47.  
  48. /* AS3 to haxe
  49.       public static function toArray(param1:String) : ByteArray
  50.       {
  51.          param1 = param1.replace(/\s|:/gm,"");
  52.          var _loc2_:ByteArray = new ByteArray();
  53.          if(param1.length & 1 == 1)
  54.          {
  55.             param1 = "0" + param1;
  56.          }
  57.          var _loc3_:uint = 0;
  58.          while(_loc3_ < param1.length)
  59.          {
  60.             _loc2_[_loc3_ / 2] = parseInt(param1.substr(_loc3_,2),16);
  61.             _loc3_ = _loc3_ + 2;
  62.          }
  63.          return _loc2_;
  64.       }
  65.      
  66.       public static function fromArray(param1:ByteArray, param2:Boolean = false) : String
  67.       {
  68.          var _loc3_:* = "";
  69.          var _loc4_:uint = 0;
  70.          while(_loc4_ < param1.length)
  71.          {
  72.             _loc3_ = _loc3_ + ("0" + param1[_loc4_].toString(16)).substr(-2,2);
  73.             if(param2)
  74.             {
  75.                if(_loc4_ < param1.length - 1)
  76.                {
  77.                   _loc3_ = _loc3_ + ":";
  78.                }
  79.             }
  80.             _loc4_++;
  81.          }
  82.          return _loc3_;
  83.       }
  84. */
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement