// Constructor public PacketForge(Connection connection) { first_packet_ = true; login_ = true; connection_ = connection; blowfish_cipher_ = new BlowfishEngine(); crypt_ = new Crypt(); output_ = OutputDebug.get_instance(); }
// Connect button click private void dlgConnect_Click(object sender, EventArgs e) { connection_ = new Connection(); connection_.connect("83.171.11.57", 2106);//178.162.166.11 // l2_client_.Connect("178.162.166.11", 2106); // recv_send_stream_ = l2_client_.GetStream(); // int byte_count = recv_send_stream_.Read(data_buffer_, 0, 65533); //#if DEBUG // output_.output_debug("-client-recv[" + byte_count + "]: "); // output_.output_debug(data_buffer_, byte_count); //#endif // blowfish_cipher_.init(false, blowfish_key_); // blowfish_cipher_.processBigBlock(data_buffer_, 0x02, decoded_buffer_, 0x00, byte_count - 2); // Global.decXORPass(decoded_buffer_, 0x00, byte_count - 2, // System.BitConverter.ToInt32(decoded_buffer_, byte_count - 10)); // RSA_key_[0] = decoded_buffer_[1]; // RSA_key_[1] = decoded_buffer_[2]; // RSA_key_[2] = decoded_buffer_[3]; // RSA_key_[3] = decoded_buffer_[4]; // for (int i = 0; i < 128; i++) // { // RSA_enc_key_[i] = decoded_buffer_[9 + i]; // } // for (int i = 0; i < 0x40; i++) // { // RSA_enc_key_[0x40 + i] = (byte)(RSA_enc_key_[0x40 + i] ^ RSA_enc_key_[i]); // } // for (int i = 0; i < 4; i++) // { // RSA_enc_key_[0x0d + i] = (byte)(RSA_enc_key_[0x0d + i] ^ RSA_enc_key_[0x34 + i]); // } // // step 2 : xor first 0x40 bytes with last 0x40 bytes // for (int i = 0; i < 0x40; i++) // { // RSA_enc_key_[i] = (byte)(RSA_enc_key_[i] ^ RSA_enc_key_[0x40 + i]); // } // // step 1 : 0x4d-0x50 <-> 0x00-0x04 // for (int i = 0; i < 4; i++) // { // byte temp = RSA_enc_key_[0x00 + i]; // RSA_enc_key_[0x00 + i] = RSA_enc_key_[0x4D + i]; // RSA_enc_key_[0x4d + i] = temp; // } //#if DEBUG // output_.output_debug("-client-recv-dec: "); // output_.output_debug(decoded_buffer_, byte_count); //#endif // for (int i = 0; i < 16; i++) // blowfish_key_[i] = decoded_buffer_[i + 153]; //#if DEBUG // output_.output_debug("-client-new-blowfish-key: "); // output_.output_debug(blowfish_key_, 16); // output_.output_debug("-client-RSA-key: "); // output_.output_debug(RSA_enc_key_, 128); // output_.output_debug("-client-GameGuard-packet"); //#endif // // wtf Oo (?) // byte[] send_packet = new byte[40]; // byte[] pre_send_packet = new byte[40]; // send_packet[0] = 0x07; // Request GG packet // send_packet[1] = RSA_key_[0]; // send_packet[2] = RSA_key_[1]; // send_packet[3] = RSA_key_[2]; // send_packet[4] = RSA_key_[3]; // game_guard_fill(send_packet, 0x05); // ulong checksum = Global.CheckSum(send_packet, 0x18); // send_packet[24] = (byte)(checksum & 0xff); // send_packet[25] = (byte)(checksum >> 0x08 & 0xff); // send_packet[26] = (byte)(checksum >> 0x10 & 0xff); // send_packet[27] = (byte)(checksum >> 0x18 & 0xff); // blowfish_cipher_.init(true, blowfish_key_); // blowfish_cipher_.processBigBlock(send_packet, 0, pre_send_packet, 0, 40); // byte[] out_packet = new byte[42]; // out_packet[0] = 0x2A; // out_packet[1] = 0x00; // pre_send_packet.CopyTo(out_packet, 2); // recv_send_stream_.Write(out_packet, 0, 42); // byte_count = recv_send_stream_.Read(data_buffer_, 0, 65533); //#if DEBUG // output_.output_debug("-client-recv-GOOD?[" + byte_count + "]: "); // output_.output_debug(data_buffer_, byte_count); //#endif // blowfish_cipher_.init(false, blowfish_key_); // blowfish_cipher_.processBigBlock(data_buffer_, 2, decoded_buffer_, 0, byte_count - 2); // //Global.decXORPass(decoded_buffer_, 0x00, byte_count - 2, // // System.BitConverter.ToInt32(decoded_buffer_, byte_count - 10)); //#if DEBUG // output_.output_debug("-client-recv-decGOOD?++++: "); // output_.output_debug(decoded_buffer_, byte_count); //#endif }