public SP0X0828(MessageHelper msgHelper, int id) { QqnumInfo ins = new QQNUM().ISelect(string.Format("QQ='{0}'", msgHelper.QQ))[0]; this.bytes = Tools.HexStringToBytes(this.string_bytes); this.raw_data = Tools.HexStringToBytes(ins.SP0X0828); this.InitSp(msgHelper); }
public SP0X0826(MessageHelper msgHelper, int id) { QqnumInfo ins = new QQNUM().ISelect(string.Format("QQ='{0}'", msgHelper.QQ))[0]; //this.raw_data2 = Tools.HexStringToBytes(this.string_verifybytes); //this.raw_data = Tools.HexStringToBytes(this.string_raw_data); this.verify_data = Tools.HexStringToBytes(ins.VERIFYKEY); this.raw_data = Tools.HexStringToBytes(ins.SP0X0826); this.last_data = Tools.HexStringToBytes(this.string_last_data); this.bytes = Tools.HexStringToBytes(this.string_bytes); this.InitSp(msgHelper); }
byte[] rp0x00CD;//发送消息 void rs_PacketArrival(object sender, ZNQQ.DataCap.RawSocket.PacketArrivedEventArgs args) { //throw new NotImplementedException(); if (args.Protocol == "UDP:") { byte[] bytes = new byte[args.MessageLength - 8]; Array.Copy(args.MessageBuffer, 8, bytes, 0, args.MessageLength - 8); //if (bytes[0] != 0x02) return; //this.msgHelper_debugHelper(System.DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss") + Tools.BytesToHexString(Tools.RB(bytes, 3, 2))); //if (Tools.BytesToQQ(Tools.RB(bytes, 7, 4)) != "121852835") return;//过滤QQ号 string QQ = Tools.BytesToQQ(Tools.RB(bytes, 7, 4)); //this.msgHelper_debugHelper(string.Format("目标:{0},{1}", args.DestinationAddress, args.DestinationPort)); switch (Tools.BytesToPort(Tools.RB(bytes, 3, 2))) { case 0x0825: if (bytes.Length == 115) //发包 { this.key0x0825 = Tools.RB(bytes, 26, 16); this.sp0x0825 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 42, 72), this.key0x0825); if (!this.cbR0x0825.Checked) { return; } this.msgHelper_debugHelper("S0x0825_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("S0x0825:" + Tools.BytesToHexString(this.sp0x0825)); } if (bytes.Length == 111) //收包 { this.rp0x0825 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, 96), this.key0x0825); if (!this.cbS0x0825.Checked) { return; } this.msgHelper_debugHelper("R0x0825_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("R0x0825:" + Tools.BytesToHexString(this.rp0x0825)); } break; case 0x0826: if (bytes.Length == 499) //发包 { this.key0x0826 = Tools.RB(bytes, 26, 16); this.sp0x0826 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 42, 456), this.key0x0826); QqnumInfo ins = new QQNUM().ISelect(string.Format("QQ='{0}'", QQ))[0]; this.verifykey = Tools.GetVerifyKey(ins.QQ, ins.PASS); this.verifybytes = new QQCrypt().QQ_Decrypt(Tools.RB(this.sp0x0826, 74, 120), this.verifykey); this.keyfor0x0826recv = Tools.RB(this.verifybytes, 88, 16); if (!this.cbS0x0826.Checked) { return; } this.msgHelper_debugHelper("S0x0826_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("S0x0826:" + Tools.BytesToHexString(this.sp0x0826)); this.msgHelper_debugHelper("verifybytes:" + Tools.BytesToHexString(this.verifybytes)); } //if (bytes.Length == 743)//收包 //{ // this.rp0x0826 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, 728), this.keyfor0x0826recv); // this.keyfor0x0828send = Tools.RB(this.rp0x0826,7, 16); // this.keyfor0x0828recv = Tools.RB(this.rp0x0826, 235, 16); // if (!this.cbR0x0826.Checked) return; // this.msgHelper_debugHelper("R0x0826_bytes:" + Tools.BytesToHexString(bytes)); // this.msgHelper_debugHelper("R0x0826:" + Tools.BytesToHexString(this.rp0x0826)); //} //if (bytes.Length == 759)//收包 //{ // this.rp0x0826 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, 744), this.keyfor0x0826recv); // this.keyfor0x0828send = Tools.RB(this.rp0x0826, 7, 16); // this.keyfor0x0828recv = Tools.RB(this.rp0x0826, 235, 16); // if (!this.cbR0x0826.Checked) return; // this.msgHelper_debugHelper("R0x0826_bytes:" + Tools.BytesToHexString(bytes)); // this.msgHelper_debugHelper("R0x0826:" + Tools.BytesToHexString(this.rp0x0826)); // this.msgHelper_debugHelper("verifybytes:" + Tools.BytesToHexString(this.verifybytes)); //} if (743 <= bytes.Length && bytes.Length <= 839) //收包 { this.rp0x0826 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, bytes.Length - 14 - 1), this.keyfor0x0826recv); this.keyfor0x0828send = Tools.RB(this.rp0x0826, 7, 16); this.keyfor0x0828recv = Tools.RB(this.rp0x0826, 235, 16); if (!this.cbR0x0826.Checked) { return; } this.msgHelper_debugHelper("R0x0826_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("R0x0826:" + Tools.BytesToHexString(this.rp0x0826)); } if (bytes.Length == 855) //收包-需要验证 { this.msgHelper_debugHelper("需要验证:" + Tools.BytesToHexString(bytes)); } break; case 0x0828: if (557 <= bytes.Length && bytes.Length <= 581) //发包 { this.sp0x0828 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 84, bytes.Length - 84 - 1), this.keyfor0x0828send); if (!this.cbS0x0828.Checked) { return; } this.msgHelper_debugHelper("S0x0828_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("S0x0828:" + Tools.BytesToHexString(this.sp0x0828)); } if (bytes.Length == 399) //收包 { this.rp0x0828 = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, 384), this.keyfor0x0828recv); this.snkey = Tools.RB(this.rp0x0828, 25, 16); if (this.cbR0x0828.Checked) { this.msgHelper_debugHelper("R0x0828_bytes:" + Tools.BytesToHexString(bytes)); this.msgHelper_debugHelper("R0x0828:" + Tools.BytesToHexString(this.rp0x0828)); } if (this.cbSNKEY.Checked) { this.msgHelper_debugHelper("snkey:" + Tools.BytesToHexString(this.snkey)); } pack.QQ = Tools.BytesToQQ(Tools.RB(bytes, 7, 4)); pack.SP0X0825 = Tools.BytesToHexString(this.sp0x0825); pack.RP0X0825 = Tools.BytesToHexString(this.rp0x0825); pack.SP0X0826 = Tools.BytesToHexString(this.sp0x0826); pack.VERIFYKEY = Tools.BytesToHexString(this.verifybytes); pack.RP0X0826 = Tools.BytesToHexString(this.rp0x0826); pack.SP0X0828 = Tools.BytesToHexString(this.sp0x0828); pack.RP0X0828 = Tools.BytesToHexString(this.rp0x0828); pack.Create(); QqnumInfo ins = new QqnumInfo(); ins.QQ = Tools.BytesToQQ(Tools.RB(bytes, 7, 4)); ins.SP0X0825 = Tools.BytesToHexString(this.sp0x0825); ins.RP0X0825 = Tools.BytesToHexString(this.rp0x0825); ins.SP0X0826 = Tools.BytesToHexString(this.sp0x0826); ins.VERIFYKEY = Tools.BytesToHexString(this.verifybytes); ins.RP0X0826 = Tools.BytesToHexString(this.rp0x0826); ins.SP0X0828 = Tools.BytesToHexString(this.sp0x0828); ins.RP0X0828 = Tools.BytesToHexString(this.rp0x0828); XResult rst = new XResult(); new QQNUM().Update(ins, rst); } break; case 0x00CD: if (bytes.Length > 31) { this.rp0x00CD = new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 22, bytes.Length - 23), this.snkey); if (!this.cbS0x00CD.Checked) { return; } this.msgHelper_debugHelper("R0x00CD:" + Tools.BytesToHexString(this.rp0x00CD)); if (rp0x00CD.Length > 116) { this.msgHelper_debugHelper("R0x00CD:" + Encoding.UTF8.GetString(Tools.RB(this.rp0x00CD, 116, this.rp0x00CD.Length - 116))); } } if (bytes.Length == 31) { if (!this.cbR0x00CD.Checked) { return; } this.msgHelper_debugHelper("R0x00CD:" + Tools.BytesToHexString(new QQCrypt().QQ_Decrypt(Tools.RB(bytes, 14, bytes.Length - 15), this.snkey))); } break; case 0x00EC: this.msgHelper_debugHelper("0x00EC:" + Tools.BytesToHexString(bytes)); break; default: // this.msgHelper_debugHelper(Tools.BytesToHexString(bytes)); break; } //this.msgHelper_debugHelper(Tools.BytesToHexString(bytes)); } }