예제 #1
0
        void OnReceive_0x0826(byte[] bytes)
        {
            append_bytes(bytes);

            this.debugHelper("进入0x0826处理<<==");
            if (743 <= bytes.Length && bytes.Length <= 839)
            {
                byte[] data = new byte[bytes.Length - 14 - 1];//728bytes
                Array.Copy(bytes, 14, data, 0, data.Length);
                //byte[] key = new byte[16];
                byte[] raw_data = new QQCrypt().QQ_Decrypt(data, this.keyfor0x0826recv);
                //this.debugHelper(string.Format("返回{0}字节:", bytes.Length.ToString()) + Tools.BytesToHexString(bytes));
                //this.debugHelper(string.Format("data:{0}",  Tools.BytesToHexString(data)));
                //this.debugHelper(string.Format("key:{0}", Tools.BytesToHexString(key)));
                //this.debugHelper(string.Format("raw_data:{0}", Tools.BytesToHexString(raw_data)));
                byte[] token  = new byte[56];
                byte[] token1 = new byte[112];
                Array.Copy(raw_data, 255, this.loginTime, 0, 4);
                Array.Copy(raw_data, 25, token, 0, 56);
                Array.Copy(raw_data, 269, token1, 0, 112);
                byte[] keyfor0x0828send = new byte[16];
                Array.Copy(raw_data, 7, keyfor0x0828send, 0, 16);
                this.keyfor0x0828recv = new byte[16];
                Array.Copy(raw_data, 235, this.keyfor0x0828recv, 0, 16);
                debugHelper(string.Format("keyfor0x0828recv:{0}", Tools.BytesToHexString(this.keyfor0x0828recv)));
                debugHelper(string.Format("{0}", Tools.BytesToHexString(raw_data)));
                this.Send_0x0828(token, token1, keyfor0x0828send);
            }
            else
            {
                this.debugHelper(string.Format("返回{0}字节:", bytes.Length.ToString()) + Tools.BytesToHexString(bytes));
            }

            //this.Send_0x0828();
        }
예제 #2
0
        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);
        }
예제 #3
0
 private void btnEnCrypt_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] data = Tools.HexStringToBytes(this.rtbData.Text);
         byte[] key = Tools.HexStringToBytes(this.rtbKEY.Text);
         byte[] raw_data = Tools.HexStringToBytes(this.rtbRawData.Text);
         data = new QQCrypt().QQ_Encrypt(raw_data, key);
         this.rtbData.Text = Tools.BytesToHexString(data);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #4
0
 private void btnEnCrypt_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] data     = Tools.HexStringToBytes(this.rtbData.Text);
         byte[] key      = Tools.HexStringToBytes(this.rtbKEY.Text);
         byte[] raw_data = Tools.HexStringToBytes(this.rtbRawData.Text);
         data = new QQCrypt().QQ_Encrypt(raw_data, key);
         this.rtbData.Text = Tools.BytesToHexString(data);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #5
0
        unsafe void OnReceive_0x00CE(byte[] bytes)
        {
            this.debugHelper("进入0x00CE处理<<==");
            //this.debugHelper(Tools.BytesToHexString(bytes));
            byte[] data = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, bytes.Length - 15), this.sessionKey);
            switch ((int)data[23])
            {
            case 0x1b:
                this.debugHelper("收到好友消息:" + Encoding.UTF8.GetString(Tools.RB(data, 142, (int)data[141])));
                break;

            case 0x0d:
                this.debugHelper("收到??消息:" + Encoding.UTF8.GetString(Tools.RB(data, 128, (int)data[127])));
                break;

            default:
                this.debugHelper(Tools.BytesToHexString(data));
                break;
            }
        }
예제 #6
0
 void OnReceive_0x00EC(byte[] bytes)
 {
     this.debugHelper("进入0x00EC处理<<==");
     byte[] data = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, 16), this.sessionKey);
     debugHelper(string.Format("0x00EC[{0}]:{1}", data.Length, Tools.BytesToHexString(data)));
 }
예제 #7
0
        void OnReceive_0x0826(byte[] bytes)
        {
            append_bytes(bytes);

            this.debugHelper("进入0x0826处理<<==");
            if ( 743 <=bytes.Length && bytes.Length <= 839)
            {
                byte[] data = new byte[bytes.Length-14-1];//728bytes
                Array.Copy( bytes,14,data,0,data.Length);
                //byte[] key = new byte[16];
                byte[] raw_data =new QQCrypt().QQ_Decrypt(data, this.keyfor0x0826recv);
                //this.debugHelper(string.Format("返回{0}字节:", bytes.Length.ToString()) + Tools.BytesToHexString(bytes));
                //this.debugHelper(string.Format("data:{0}",  Tools.BytesToHexString(data)));
                //this.debugHelper(string.Format("key:{0}", Tools.BytesToHexString(key)));
                //this.debugHelper(string.Format("raw_data:{0}", Tools.BytesToHexString(raw_data)));
                byte[] token = new byte[56];
                byte[] token1 = new byte[112];
                Array.Copy(raw_data, 255, this.loginTime, 0, 4);
                Array.Copy(raw_data, 25, token, 0, 56);
                Array.Copy(raw_data, 269, token1, 0, 112);
                byte[] keyfor0x0828send = new byte[16];
                Array.Copy(raw_data, 7, keyfor0x0828send, 0, 16);
                this.keyfor0x0828recv = new byte[16];
                Array.Copy(raw_data, 235, this.keyfor0x0828recv, 0, 16);
                debugHelper(string.Format("keyfor0x0828recv:{0}", Tools.BytesToHexString(this.keyfor0x0828recv)));
                debugHelper(string.Format("{0}", Tools.BytesToHexString(raw_data)));
                this.Send_0x0828(token,token1, keyfor0x0828send);

            }
            else
            {
                this.debugHelper(string.Format("返回{0}字节:", bytes.Length.ToString()) + Tools.BytesToHexString(bytes));
            }

            //this.Send_0x0828();
        }
예제 #8
0
        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);
        }
예제 #9
0
 void OnReceive_0x00EC(byte[] bytes)
 {
     this.debugHelper("进入0x00EC处理<<==");
     byte[] data = new QQCrypt().QQ_Decrypt(Tools.RB(bytes,14,16), this.sessionKey);
     debugHelper(string.Format("0x00EC[{0}]:{1}", data.Length, Tools.BytesToHexString(data)));
 }
예제 #10
0
 unsafe void OnReceive_0x00CE(byte[] bytes)
 {
     this.debugHelper("进入0x00CE处理<<==");
     //this.debugHelper(Tools.BytesToHexString(bytes));
     byte[] data = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, bytes.Length - 15), this.sessionKey);
     switch ((int)data[23])
     {
         case 0x1b:
             this.debugHelper("收到好友消息:" + Encoding.UTF8.GetString(Tools.RB(data, 142, (int)data[141])));
             break;
         case 0x0d:
             this.debugHelper("收到??消息:" + Encoding.UTF8.GetString(Tools.RB(data, 128, (int)data[127])));
             break;
         default:
             this.debugHelper(Tools.BytesToHexString(data));
             break;
     }
 }