public static List <string> GetGroupList(long thisQQ) { API.ThisQQ = thisQQ; JceStructSDK.GetGroupList(thisQQ); done.WaitOne(); return(ListResult); }
public static List <string> GetGroupMemberList(long groupId) { API.GroupId = groupId; JceStructSDK.GetGroupMemberList(groupId); done.WaitOne(); return(ListResult); }
public static void DeleteGroup(long thisQQ, long GroupId) { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeByte(9, 0)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(thisQQ, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeSimpleList(API.HexStrToByteArray(GroupId.ToString("X")).Concat(API.QQ.user).ToArray(), 2)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(3)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(5)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(6)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(7)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(8)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(9)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(10)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 11)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 12)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 0)).ToArray(); var dic = new Dictionary <object, object>() { { "GroupMngReq", bytes } }; bytes = JceStruct.writeMap(dic, 0); //Debug.Print("解散群:" + Environment.NewLine + BitConverter.ToString(bytes).Replace("-", " ")) bytes = JceStructSDK.Pack_HeadJce(API.QQ.mRequestID, "KQQ.ProfileService.ProfileServantObj", "GroupMngReq", bytes); bytes = API.PackCmdHeader("ProfileService.GroupMngReq", bytes); API.TClient.SendData(API.PackAllHeader(bytes)); }
public static void GetNick(long QQId) { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeByte(0, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 2)).ToArray(); bytes = bytes.Concat(JceStruct.writeList(JceStruct.writeLong(QQId, 0), 3)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 5)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(0, 6)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(0, 7)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(0, 8)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 9)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(0, 10)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 11)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 0)).ToArray(); var dic = new Dictionary <object, object>() { { "req", bytes } }; bytes = JceStruct.writeMap(dic, 0); bytes = JceStructSDK.Pack_HeadJce(API.QQ.mRequestID, "KQQ.ProfileService.ProfileServantObj", "GetSimpleInfo", bytes); bytes = API.PackCmdHeader("ProfileService.GetSimpleInfo", bytes); API.TClient.SendData(API.PackAllHeader(bytes)); }
public static void ReplyConfigPushSvc(byte[] BytesIn, int ssoseq) { JceStruct.StartDecode(BytesIn); if (JceStruct.DicSimpleList.Count > 0) { var Hex = JceStruct.DicSimpleList[0].ElementAt(0).Value; JceStruct.StartDecode(API.HexStrToByteArray(Hex)); if (JceStruct.DicSimpleList.Count > 0) { Hex = JceStruct.DicSimpleList[0].ElementAt(0).Value; JceStruct.StartDecode(API.HexStrToByteArray(Hex)); byte P1 = new byte(); long P2 = 0; if (JceStruct.DicByte.Count > 0) { byte.TryParse(JceStruct.DicByte[0].ElementAt(0).Value, out P1); if (P1 != 2) { return; } } if (JceStruct.DicInt.Count > 0) { P2 = int.Parse(JceStruct.DicInt[0].ElementAt(0).Value); } else if (JceStruct.DicLong.Count > 0) { P2 = long.Parse(JceStruct.DicLong[0].ElementAt(0).Value); } var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeByte(P1, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(P2, 2)).ToArray(); var dic = new Dictionary <object, object>() { { "PushResp", bytes } }; bytes = JceStruct.writeMap(dic, 1); Debug.Print("ReplyConfigPushSvc:" + bytes.Length.ToString() + "\r\n" + BitConverter.ToString(bytes).Replace("-", " ")); bytes = JceStructSDK.Pack_HeadJce(API.QQ.mRequestID, "QQService.ConfigPushSvc.MainServant", "PushResp", bytes); bytes = API.PackCmdHeader("ConfigPushSvc.PushResp", bytes); API.TClient.SendData(API.PackAllHeader(bytes)); } } }
public static void LeavingGroup(long thisQQ, long GroupId) { JceStructSDK.ExitGroup(thisQQ, GroupId); }
public static void DisbandGroup(long thisQQ, long GroupId) { JceStructSDK.DeleteGroup(thisQQ, GroupId); }
public static List <string> GetQQNick(long AnyQQ) { JceStructSDK.GetNick(AnyQQ); done.WaitOne(); return(ListResult); }
public static byte[] UnPackReceiveData(byte[] ReceiveData) { if (ReceiveData.Length == 0) { return(null); } byte[] teaBytes = null; try { UpdateSyncCoookies(); Debug.Print("收到包:" + ReceiveData.Length.ToString() + "\r\n" + BitConverter.ToString(ReceiveData).Replace("-", " ")); var packType = ReceiveData.Skip(7).Take(1).ToArray()[0]; var encrptType = ReceiveData.Skip(8).Take(1).ToArray()[0]; int pos = API.SearchBytes(ReceiveData, API.QQ.UTF8); var bytes = ReceiveData.Skip(pos + API.QQ.UTF8.Length).ToArray(); teaBytes = bytes; HashTea Hash = new HashTea(); if (packType == 0xB && packType == 9) { if (encrptType == 1) { bytes = Hash.UNHashTEA(bytes, API.QQ.key, 0, true); } else if (encrptType == 2) { bytes = Hash.UNHashTEA(bytes, API.QQ.shareKey, 0, true); } } else if (packType == 0xA && packType == 8) { if (encrptType == 1) { bytes = Hash.UNHashTEA(bytes, API.QQ.shareKey, 0, true); } else if (encrptType == 2) { bytes = Hash.UNHashTEA(bytes, API.QQ.key, 0, true); } } else if (packType == 0xA && packType == 10) { if (encrptType == 1) { bytes = Hash.UNHashTEA(bytes, API.UN_Tlv.T305_SessionKey, 0, true); } else if (encrptType == 2) { bytes = Hash.UNHashTEA(bytes, API.QQ.key, 0, true); } } else { bytes = Hash.UNHashTEA(bytes, API.UN_Tlv.T305_SessionKey, 0, true); } Debug.Print("解密后:" + bytes.Length.ToString() + "\r\n" + BitConverter.ToString(bytes).Replace("-", " ")); //取出第一层包头中的包长度值 if (BitConverter.ToInt16(bytes.Take(2).ToArray(), 0) != 0) { Debug.Print("未解析" + "\r\n" + BitConverter.ToString(teaBytes).Replace("-", " ")); Debug.Print("ShareKey" + "\r\n" + BitConverter.ToString(API.QQ.shareKey).Replace("-", " ")); Debug.Print("SessionKey" + "\r\n" + BitConverter.ToString(API.UN_Tlv.T305_SessionKey).Replace("-", " ")); return(null); } var head1_len = BitConverter.ToInt32(bytes.Take(4).ToArray().Reverse().ToArray(), 0); byte[] bodyBytes = bytes.Skip(head1_len).ToArray(); Debug.Print("主包体:" + bodyBytes.Length.ToString() + "\r\n" + BitConverter.ToString(bodyBytes).Replace("-", " ")); if (head1_len > 4) { bytes = bytes.Skip(4).Take(head1_len - 4).ToArray(); bytes = bytes.Skip(4).ToArray(); if (bytes.Skip(4).Take(4).ToArray() == new byte[] { 0, 0, 0, 0 }) { bytes = bytes.Skip(4).ToArray(); } else { var head3_len = BitConverter.ToInt32(bytes.Skip(4).Take(4).ToArray().Reverse().ToArray(), 0); bytes = bytes.Skip(head3_len + 4).ToArray(); } var str_len = BitConverter.ToInt32(bytes.Take(4).ToArray().Reverse().ToArray(), 0); if (str_len > 4) { var serviceCmd = Encoding.UTF8.GetString(bytes.Skip(4).ToArray(), 0, str_len - 4); if (serviceCmd.Contains("wtlogin.login")) { Debug.Print("收到命令:wtlogin.login"); //解析登录包体 var status = Un_Pack_Login(bodyBytes); Debug.Print("status:" + status.ToString()); if (status == 1) { Debug.Print("wtlogin.login"); SDK.GetLog("登录成功"); //发上线包 API.TClient.SendData(Pack.PackOnlineStatus("StatSvc.register", 0)); } else if (status == 0) { Microsoft.VisualBasic.Interaction.MsgBox(API.getLastError(), (Microsoft.VisualBasic.MsgBoxStyle)((int)Microsoft.VisualBasic.Constants.vbInformation + (int)Microsoft.VisualBasic.Constants.vbMsgBoxSetForeground + (int)Microsoft.VisualBasic.Constants.vbSystemModal + (int)Microsoft.VisualBasic.Constants.vbCritical + (int)Microsoft.VisualBasic.Constants.vbInformation), "登录失败"); } else if (status == 2) { API.QQ.loginState = (int)API.LoginState.Logining; if (API.UN_Tlv.T143_token_A2 != null && API.QQ.shareKey != null && API.UN_Tlv.T10A_token_A4 != null) { API.TClient.SendData(Pack.PackOnlineStatus("StatSvc.register", 1)); } } } else if (serviceCmd.Contains("PushService.register")) { Debug.Print("服务器注册成功:PushService.register"); } else if (serviceCmd.Contains("RegPrxySvc.PushParam")) { Debug.Print("RegPrxySvc.PushParam命令"); } else if (serviceCmd.Contains("ConfigPushSvc.PushDomain")) { Debug.Print("成功登录服务器:ConfigPushSvc.PushDomain"); SDK.GetLog("上线成功"); } else if (serviceCmd.Contains("OnlinePush.ReqPush")) { Debug.Print("OnlinePush.ReqPush系统推送消息、撤回、加好友等"); } else if (serviceCmd.Contains("ConfigPushSvc.PushReq")) { Debug.Print("回执ConfigPushSvc.PushReq"); JceStructSDK.ReplyConfigPushSvc(bodyBytes, API.QQ.mRequestID); } else if (serviceCmd.Contains("StatSvc.SimpleGet")) { Debug.Print("收到心跳包"); SDK.GetHeartBeatResult(true); } else if (serviceCmd.Contains("MessageSvc.PushNotify")) { Debug.Print("通知好友消息:" + bytes.Length.ToString() + "\r\n" + BitConverter.ToString(bytes).Replace("-", " ")); bytes = bytes.Reverse().ToArray(); var code = bytes.Skip(15).Take(4).ToArray().Reverse().ToArray(); var sendByte = Pack.PackFriendMsg(code); //组包获取好友消息 API.TClient.SendData(sendByte); } else if (serviceCmd.Contains("MessageSvc.PbGetMsg")) { Debug.Print("收到好友消息"); FriendMsg.ParsingFriendMsg(bodyBytes); } else if (serviceCmd.Contains("OnlinePush.PbPushGroupMsg")) { Debug.Print("群聊消息"); GroupMsg.ParsingGroupMsg(bodyBytes); } else if (serviceCmd.Contains("MessageSvc.RequestPushStatus")) { Debug.Print("上线下线状态改变"); } else if (serviceCmd.Contains("MessageSvc.PushReaded")) { Debug.Print("已读私人消息"); } else if (serviceCmd.Contains("OnlinePush.PbC2CMsgSync")) { Debug.Print("发私人消息"); } else if (serviceCmd.Contains("RegPrxySvc.PbGetGroupMsg")) { Debug.Print("群消息"); } else if (serviceCmd.Contains("RegPrxySvc.PullGroupMsgSeq")) { Debug.Print("拉取群消息Seq"); } else if (serviceCmd.Contains("MessageSvc.PbGetOneDayRoamMsg")) { Debug.Print("解析漫游消息"); } else if (serviceCmd.Contains("RegPrxySvc.PbSyncMsg")) { Debug.Print("同步历史消息"); } else if (serviceCmd.Contains("SSO.HelloPush")) { Debug.Print("回执SSO.HelloPush"); Pack.ReplySSOHelloPush(bodyBytes, API.QQ.mRequestID); } else if (serviceCmd.Contains("StatSvc.SvcReqMSFLoginNotify")) { Debug.Print("平板上/下线通知"); } else if (serviceCmd.Contains("MessageSvc.RequestPushStatus")) { Debug.Print("电脑上/下线通知"); } else if (serviceCmd.Contains("StatSvc.ReqMSFOffline")) { Debug.Print("异常提醒"); } else if (serviceCmd.Contains("StatSvc.QueryHB")) { Debug.Print("StatSvc.QueryHB"); } else if (serviceCmd.Contains("MessageSvc.PushForceOffline")) { Debug.Print("被顶下线"); SDK.GetLog("被顶下线"); } else if (serviceCmd.Contains("MessageSvc.PbSendMsg")) { Debug.Print("递增发送信息"); API.QQ.mRequestID = API.QQ.mRequestID + 1; } else if (serviceCmd.Contains("OnlinePush.PbC2CMsgSync")) { Debug.Print("同步递增发送信息"); } else if (serviceCmd.Contains("OnlinePush.PbPushDisMsg")) { Debug.Print("讨论组消息"); } else if (serviceCmd.Contains("OnlinePush.PbPushTransMsg")) { Debug.Print("管理员变动"); } else if (serviceCmd.Contains("friendlist.GetTroopListReqV2")) { Debug.Print("群列表"); JceStructSDK.GetGrouplist(bodyBytes); } else if (serviceCmd.Contains("friendlist.getFriendGroupList")) { Debug.Print("好友列表"); JceStructSDK.GetFriendlist(bodyBytes); } else if (serviceCmd.Contains("friendlist.GetTroopMemberList")) { Debug.Print("群成员列表"); JceStructSDK.GetGroupMemberlist(bodyBytes); } else if (serviceCmd.Contains("OidbSvc.0x899_0")) { Debug.Print("群管理列表"); ProtoSDK.GetGroupAdminlist(bodyBytes); } else if (serviceCmd.Contains("ProfileService.Pb.ReqSystemMsgNew.Friend")) { Debug.Print("新好友提醒"); } else if (serviceCmd.Contains("ProfileService.Pb.ReqNextSystemMsg.Friend")) { Debug.Print("加好友消息提醒"); } else if (serviceCmd.Contains("ProfileService.Pb.ReqSystemMsgNew.Group")) { Debug.Print("新群提醒"); } else if (serviceCmd.Contains("QualityTest.PushList")) { Debug.Print("回执QualityTest.PushList"); Pack.ReplyQualityTest(API.QQ.mRequestID + 1); } else if (serviceCmd.Contains("OnlinePush.SidTicketExpired")) { Debug.Print("回执门票过期"); } else if (serviceCmd.Contains("PubAccountSvc.get_follow_list")) { Debug.Print("获取列表"); } else if (serviceCmd.Contains("account.RequestQueryQQMobileContactsV3")) { Debug.Print("查询内容"); } else if (serviceCmd.Contains("ProfileService.GetSimpleInfo")) { Debug.Print("获取QQ资料信息"); JceStructSDK.GetSimpleInfo(bodyBytes); } else if (serviceCmd.Contains("StatSvc.register")) { Debug.Print("注册上线:StatSvc.register"); } else if (serviceCmd.Contains("PbMessageSvc.PbMsgReadedReport")) { Debug.Print("已读消息"); } else if (serviceCmd.Contains("OidbSvc.0x59f")) { Debug.Print("OidbSvc.0x59f命令"); JceStructSDK.GetRegSync_Info(); } else if (serviceCmd.Contains("RegPrxySvc.infoSync")) { Debug.Print("RegPrxySvc.infoSync命令"); } else if (serviceCmd.Contains("RegPrxySvc.GetMsgV2")) { Debug.Print("RegPrxySvc.GetMsgV2命令"); } else if (serviceCmd.Contains("LongConn.OffPicUp")) { Debug.Print("收到图片反馈LongConn.OffPicUp"); FriendMsg.SendFriendMsg(API.ThisQQ, API.SendQQ, bodyBytes, API.MsgType.PicMsg); } else if (serviceCmd.Contains("ImgStore.GroupPicUp")) { Debug.Print("收到群图片反馈ImgStore.GroupPicUp"); GroupMsg.SendGroupMsg(API.ThisQQ, API.GroupId, bodyBytes, API.MsgType.PicMsg, API.SendQQ); } else if (serviceCmd.Contains("PttStore.GroupPttUp")) { Debug.Print("收到群语音反馈PttStore.GroupPttUp"); GroupMsg.SendGroupAudio(bodyBytes, API.FileHash); } else if (serviceCmd.Contains("PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500")) { Debug.Print("收到好友语音反馈PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500"); FriendMsg.SendFriendAudio(API.ThisQQ, API.SendQQ, bodyBytes, API.FileHash); } else if (serviceCmd.Contains("PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_DOWNLOAD-1200")) { Debug.Print("取语音下载地址PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_DOWNLOAD-1200"); //FriendMsg.GetFriendAudioUrl(bodyBytes) } else if (serviceCmd.Contains("PbMessageSvc.PbMsgWithDraw")) { Debug.Print("撤回消息反馈PbMessageSvc.PbMsgWithDraw"); } else if (serviceCmd.Contains("SharpSvr.s2c")) { Debug.Print("语音视频电话SharpSvr.s2c"); } else { Debug.Print("其他命令" + serviceCmd); } } } } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } return(null); }