void OnReceive_0x0825(byte[] bytes) { this.debugHelper("进入0x0825处理<<=="); byte[] data = new byte[bytes.Length - 14 - 1]; Array.Copy(bytes, 14, data, 0, bytes.Length - 14 - 1); //解包 QQCrypt cry = new QQCrypt(); byte[] raw_data = cry.QQ_Decrypt(data, this.key0x0825); this.debugHelper(string.Format(" key:{0}", Tools.BytesToHexString(this.key0x0825))); this.debugHelper(string.Format("raw_data:{0}", Tools.BytesToHexString(raw_data))); this.debugHelper(string.Format(" data:{0}", Tools.BytesToHexString(data))); //解包取值 byte[] result = new byte[1]; Array.Copy(raw_data, 0, result, 0, 1); byte[] subcmd = new byte[2]; Array.Copy(raw_data, 1, subcmd, 0, 2); byte[] token_length = new byte[2]; Array.Copy(raw_data, 3, token_length, 0, 2); byte[] token = new byte[0x38]; Array.Copy(raw_data, 5, token, 0, 56); //0x38=56 byte[] unkknown = new byte[6]; Array.Copy(raw_data, 61, unkknown, 0, 6); Array.Copy(raw_data, 67, this.loginTime, 0, 4); byte[] qqip = new byte[4]; Array.Copy(raw_data, 71, qqip, 0, 4); byte[] qqport = new byte[4]; Array.Copy(raw_data, 75, qqport, 0, 2); byte[] t00 = new byte[2]; Array.Copy(raw_data, 77, t00, 0, 2); //byte[] redirect = new byte[data1.Length - 79]; Array.Copy(data1, 79, redirect, 0, data1.Length - 79); //byte[] redirect_ip = new byte[4]; Array.Copy(redirect, 16, redirect_ip, 0, 4); //debugHelper(string.Format("result :{0}", Tools.BytesToHexString(result))); short m_subcmd = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(subcmd, 0)); //debugHelper(string.Format("subcmd :0x{0}", subcmd[0].ToString("x2") + subcmd[1].ToString("x2"))); short m_token_length = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(token_length, 0)); //debugHelper(string.Format("token_length :0x{0:X}({0:D})", m_token_length)); //debugHelper(string.Format("token :{0}", Tools.BytesToHexString(token))); IPAddress m_qqip = new IPAddress(qqip); this._qqclientEP.Address = Tools.BytesToIPAddress(qqip); //this._qqclientEP.Port = Tools.BytesToPort(qqport); debugHelper(string.Format("qqip :{0}", m_qqip.ToString())); if (result[0] != 0x00) { byte[] redirect = new byte[raw_data.Length - 79]; Array.Copy(raw_data, 79, redirect, 0, raw_data.Length - 79); byte[] redirect_ip = new byte[4]; Array.Copy(redirect, 16, redirect_ip, 0, 4); debugHelper(string.Format("redirect :{0}", Tools.BytesToHexString(redirect) + string.Format("(length:{0})", Tools.BytesToHexString(redirect).Length / 2))); IPAddress m_redirect_ip = new IPAddress(redirect_ip); debugHelper(string.Format("redirect_ip :{0}", m_redirect_ip.ToString())); udp.Redirect(m_redirect_ip.ToString()); this.Send_0x0825(); } else { this.Send_0x0826(token, m_qqip); } append_bytes(raw_data); append_bytes(this.key0x0825); append_bytes(data); append_bytes(bytes); }
void OnReceive_0x0825(byte[] bytes) { this.debugHelper("进入0x0825处理<<=="); byte[] data = new byte[bytes.Length - 14 - 1]; Array.Copy(bytes,14 ,data,0,bytes.Length -14-1); //解包 QQCrypt cry = new QQCrypt(); byte[] raw_data = cry.QQ_Decrypt(data,this.key0x0825); this.debugHelper(string.Format(" key:{0}", Tools.BytesToHexString(this.key0x0825))); this.debugHelper(string.Format("raw_data:{0}", Tools.BytesToHexString(raw_data))); this.debugHelper(string.Format(" data:{0}", Tools.BytesToHexString(data))); //解包取值 byte[] result = new byte[1]; Array.Copy(raw_data, 0, result, 0, 1); byte[] subcmd = new byte[2]; Array.Copy(raw_data, 1, subcmd, 0, 2); byte[] token_length = new byte[2]; Array.Copy(raw_data, 3, token_length, 0, 2); byte[] token = new byte[0x38]; Array.Copy(raw_data, 5, token, 0, 56); //0x38=56 byte[] unkknown = new byte[6]; Array.Copy(raw_data, 61, unkknown, 0, 6); Array.Copy(raw_data, 67, this.loginTime, 0, 4); byte[] qqip = new byte[4]; Array.Copy(raw_data, 71, qqip, 0, 4); byte[] qqport = new byte[4]; Array.Copy(raw_data, 75, qqport, 0, 2); byte[] t00 = new byte[2]; Array.Copy(raw_data, 77, t00, 0, 2); //byte[] redirect = new byte[data1.Length - 79]; Array.Copy(data1, 79, redirect, 0, data1.Length - 79); //byte[] redirect_ip = new byte[4]; Array.Copy(redirect, 16, redirect_ip, 0, 4); //debugHelper(string.Format("result :{0}", Tools.BytesToHexString(result))); short m_subcmd = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(subcmd, 0)); //debugHelper(string.Format("subcmd :0x{0}", subcmd[0].ToString("x2") + subcmd[1].ToString("x2"))); short m_token_length = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(token_length, 0)); //debugHelper(string.Format("token_length :0x{0:X}({0:D})", m_token_length)); //debugHelper(string.Format("token :{0}", Tools.BytesToHexString(token))); IPAddress m_qqip = new IPAddress(qqip); this._qqclientEP.Address = Tools.BytesToIPAddress(qqip); //this._qqclientEP.Port = Tools.BytesToPort(qqport); debugHelper(string.Format("qqip :{0}",m_qqip.ToString())); if (result[0] != 0x00) { byte[] redirect = new byte[raw_data.Length - 79]; Array.Copy(raw_data, 79, redirect, 0, raw_data.Length - 79); byte[] redirect_ip = new byte[4]; Array.Copy(redirect, 16, redirect_ip, 0, 4); debugHelper(string.Format("redirect :{0}", Tools.BytesToHexString(redirect) + string.Format("(length:{0})", Tools.BytesToHexString(redirect).Length / 2))); IPAddress m_redirect_ip = new IPAddress(redirect_ip); debugHelper(string.Format("redirect_ip :{0}", m_redirect_ip.ToString())); udp.Redirect(m_redirect_ip.ToString()); this.Send_0x0825(); } else { this.Send_0x0826(token,m_qqip); } append_bytes(raw_data); append_bytes(this.key0x0825); append_bytes(data); append_bytes(bytes); }