public void SendDeviceHDInfo() { var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); DeviceHWInfoStruct DeviceInfo = new DeviceHWInfoStruct { DeviceHWInfo = new DeviceHWInfos { DeviceHWId = new DeviceHWIds { status = 1, ver = "5.0", appID = API.Device.AppId, guid = API.Device.GUIDBytes, imei = API.Device.imei, androidId = API.Device.AndroidID, imsi = API.Device.Imsi, macID = API.Device.MacId, valid = 0 }, InfoNo = 2 }, DeviceNo = 1 }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, DeviceInfo); Debug.Print("ReadedMsg" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", "")); var bytes = API.PackCmdHeader("OidbSvc.0x6de", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static byte[] GetGroupMemberList(long GroupId) { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeLong(API.QQ.LongQQ, 0)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(GroupId, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(2)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(API.Gid2Int(GroupId), 3)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(2, 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 5)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(6)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 7)).ToArray(); Dictionary <object, object> dic = new Dictionary <object, object>() { { "GTML", bytes } }; bytes = JceStruct.writeMap(dic, 0); bytes = Pack_HeadJce(API.QQ.mRequestID, "mqq.IMService.FriendListServiceServantObj", "GetTroopMemberListReq", bytes); //Debug.Print("GetGroupMemberList" + Environment.NewLine + BitConverter.ToString(bytes).Replace("-", " ")) bytes = API.PackCmdHeader("friendlist.GetTroopMemberList", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); return(bytes); }
public void SendDeviceSWInfo() { var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); DeviceSWInfoStruct DeviceInfo = new DeviceSWInfoStruct { deviceNo = 1758, deviceStatus = 0, DeviceInfo = new DeviceInfos { deviceType = 0, deviceSubId = 31, DeviceId = new DeviceIds { appID = API.Device.AppId, imei = API.Device.imei, guid = API.Device.GUIDBytes, androidId = API.Device.AndroidID } } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, DeviceInfo); Debug.Print("ReadedMsg" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", "")); var bytes = API.PackCmdHeader("OidbSvc.0x6de", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static void ShutUp(long GroupId, long HisId, long times) { if (times < 0 || times > 2591940) { times = 2591940; } var bytes = Pack.GetBytesFromLong(GroupId); bytes = bytes.Concat(new byte[] { 0x20, 0, 1 }).ToArray(); bytes = bytes.Concat(Pack.GetBytesFromLong(HisId)).ToArray(); bytes = bytes.Concat(Pack.GetBytesFromLong(times)).ToArray(); ShutUpStruct pbData = new ShutUpStruct { field1 = 1392, field2 = 8, field3 = 0, info = bytes }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, pbData); bytes = ms.ToArray(); } bytes = API.PackCmdHeader("OidbSvc.0x570_8", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); }
public static void RemoveMember(long GroupId, long HisId, bool IsRefuseNext) { byte[] bytes = null; RemoveMemberStruct pbData = new RemoveMemberStruct { field1 = 2208, field2 = 0, field3 = 0, info = new RemoveMemberInfos { GroupId = GroupId, MemberInfo = new MemberInfos { HisId = HisId, field1 = 5, field3 = IsRefuseNext } } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, pbData); bytes = ms.ToArray(); } bytes = API.PackCmdHeader("OidbSvc.0x8a0_0", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); }
public static void ShutAll(long GroupId, API.Mute Op) { if (Op == API.Mute.Close) { Op = (API.Mute) 268435455; } else { Op = 0; } byte[] bytes = null; ShutAllStruct pbData = new ShutAllStruct { field1 = 2202, field2 = 0, field3 = 0, info = new ShutAllInfos { GroupId = GroupId, status = new ShutAllFlags { op = 1 } } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, pbData); bytes = ms.ToArray(); } bytes = API.PackCmdHeader("OidbSvc.0x89a_0", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); }
public static byte[] GetGroupAdminList(long GroupId) { byte[] bytes = null; GetGroupAdminStruct pbData = new GetGroupAdminStruct { field1 = 2201, field3 = 0, GroupAdminInfo = new GroupAdminInfos { groupId = GroupId, field2 = 0, field3 = 2, field5 = new byte[] { 0x2A, 2, 8, 0 } } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, pbData); Debug.Print("取群管理列表:" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", " ")); bytes = ms.ToArray(); } bytes = API.PackCmdHeader("OidbSvc.0x899_0", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); return(bytes); }
public static bool WithdrawGroupMsg(long GroupId, long MsgReqId, long MsgRandomId) { WithdrawGroupMsgStuct WithdrawMsg = new WithdrawGroupMsgStuct { WithdrawGroupMsg = new WithdrawGroupMsgs { Amount = 1, types = 0, GroupId = GroupId, endFlag = new endFlags { flag = 0 }, WithdrawInfo = new WithdrawInfos { reqId = MsgReqId, RandomId = MsgRandomId } } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, WithdrawMsg); Debug.Print("撤回群消息结构:" + ms.ToArray().Length.ToString() + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", " ")); var bytes = API.PackCmdHeader("PbMessageSvc.PbMsgWithDraw", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } return(true); }
public static byte[] HeartbeatPack() { var bytes = API.PackCmdHeader("StatSvc.SimpleGet", null); Debug.Print("心跳包:" + "\r\n" + BitConverter.ToString(bytes).Replace("-", "")); bytes = API.PackAllHeader(bytes); return(bytes); }
public static byte[] StatSvcRegister() { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeLong(API.QQ.LongQQ, 0)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(7, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 2)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 3)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong((long)API.OnlineStaus.hide, 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 5)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 6)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 7)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 8)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 9)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 10)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(21, 11)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(1, 12)).ToArray(); bytes = bytes.Concat(JceStruct.writeString("", 13)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 14)).ToArray(); bytes = bytes.Concat(JceStruct.writeSimpleList(API.Device.GUIDBytes, 16)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(2052, 17)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 18)).ToArray(); bytes = bytes.Concat(JceStruct.writeString(API.Device.model, 19)).ToArray(); bytes = bytes.Concat(JceStruct.writeString(API.Device.model, 20)).ToArray(); bytes = bytes.Concat(JceStruct.writeString(API.Device.os_version, 21)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(1, 22)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(14798, 23)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 24)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(0, 26)).ToArray(); bytes = bytes.Concat(JceStruct.writeInt(API.IPToInt32("111.30.181.202"), 27)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 6)).ToArray(); Dictionary <object, object> dic = new Dictionary <object, object>() { { "SvcReqRegister", bytes } }; bytes = JceStruct.writeMap(dic, 0); bytes = Pack_HeadJce(0, "PushService", "SvcReqRegister", bytes); //Debug.Print("StatSvcRegister" + Environment.NewLine + BitConverter.ToString(bytes).Replace("-", " ")) bytes = API.PackCmdHeader("StatSvc.register", bytes); HashTea Hash = new HashTea(); byte[] EncodeByte = Hash.HashTEA(bytes, API.UN_Tlv.T305_SessionKey, 0, true); bytes = new byte[] { 0x0, 0x0, 0x0, 0xB, 1 }; bytes = bytes.Concat(BitConverter.GetBytes(API.QQ.mRequestID + 1).Reverse().ToArray()).ToArray(); bytes = bytes.Concat(new byte[] { 0x0 }).ToArray(); bytes = bytes.Concat(API.QQ.UTF8).ToArray(); bytes = bytes.Concat(EncodeByte).ToArray(); bytes = BitConverter.GetBytes(bytes.Length + 4).Reverse().ToArray().Concat(bytes).ToArray(); API.TClient.SendData(bytes); return(bytes); }
public static void ReplySidTicketExpired(int ssoseq) { var bytes = API.PackCmdHeader("OnlinePush.SidTicketExpired", new byte[0]); HashTea Hash = new HashTea(); byte[] encodeByte = Hash.HashTEA(bytes, API.UN_Tlv.T305_SessionKey, 0, true); bytes = new byte[] { 0, 0, 0, 0xB, 1 }.Concat(BitConverter.GetBytes(ssoseq).Reverse().ToArray()).Concat(new byte[] { 0, 0, 0 }).ToArray(); bytes = bytes.Concat(BitConverter.GetBytes(Convert.ToInt16(API.QQ.UTF8.Length + 4)).Reverse().ToArray()).ToArray().Concat(API.QQ.UTF8).ToArray(); bytes = bytes.Concat(encodeByte).ToArray(); bytes = BitConverter.GetBytes(bytes.Length + 4).Reverse().ToArray().Concat(bytes).ToArray(); API.TClient.SendData(bytes); }
public static byte[] account_RequestQueryQQMobileContactsV3() { var str = API.Device.imei + "|" + API.Device.MacId; var bytes = new byte[] { 0xA, 0xC, 0x1C, 0x2D, 0x0, 0xC, 0x30, 0x1, 0x40, 0x1, 0x5C, 0x66 }; bytes = bytes.Concat(BitConverter.GetBytes(str.Length + 4).Reverse().ToArray()).ToArray().Concat(Encoding.UTF8.GetBytes(str)).ToArray(); bytes = bytes.Concat(new byte[] { 0x70, 0x1, 0xB }).ToArray(); Dictionary <object, object> dic = new Dictionary <object, object>(); dic.Add("RequestHeader", new byte[] { 0xA, 0x0, 0x64, 0x10, 0x1E, 0x2C, 0x3C, 0x46, 0x0, 0x5C, 0x66, 0x0, 0x76, 0x0, 0x86, 0x0, 0x9C, 0xAC, 0xB }); dic.Add("RequestQueryQQMobileContactsV3", bytes); bytes = JceStruct.writeMap(dic, 0); bytes = Pack_HeadJce(API.QQ.mRequestID, "AccountServer", "AccountServerFunc", bytes); bytes = API.PackCmdHeader("account.RequestQueryQQMobileContactsV3", bytes); API.TClient.SendData(API.PackAllHeader(bytes)); return(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 bool MakeReadedGroupMsg(long GroupId, long MsgId) { MakeReadedGroupMessage ReadedMsg = new MakeReadedGroupMessage { ReadedGroupMsg = new ReadedGroupMsg { GroupId = GroupId, MsgId = MsgId } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, ReadedMsg); var bytes = API.PackCmdHeader("PbMessageSvc.PbMsgReadedReport", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } return(true); }
public void GetFollowList() { var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); GetFollowListStruct FollowList = new GetFollowListStruct { oldtimestamp = timestamp - 206323410, timestamp = timestamp, start = 0, amount = 20, types = 0, count = 0 }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, FollowList); Debug.Print("ReadedMsg" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", "")); var bytes = API.PackCmdHeader("PubAccountSvc.get_follow_list", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static void SendFriendAudio(long thisQQ, long sendQQ, byte[] AudioBytes) { using (var audioStream = new MemoryStream(AudioBytes)) { AudioBytes = audioStream.ToArray(); } API.FileHash = API.MD5Hash(AudioBytes); SendAudioMsgStruct AudioInfo = new SendAudioMsgStruct { AudioType = 500, Field2 = 0, AudioInfo = new AudioInfos { thisQQ = thisQQ, SendQQ = sendQQ, StartFlag = 2, AudioSize = AudioBytes.Length, AudioName = API.HashMD5(AudioBytes) + ".amr", AudioHash = API.FileHash }, Field101 = 17, Field102 = 104, AudioOtherInfo = new AudioOtherInfos { Field1 = 3, Field2 = 0, Field90300 = 1, Field90500 = 3, Field90600 = 2, Field90800 = 5 } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, AudioInfo); var bytes = API.PackCmdHeader("PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static byte[] GetFriendList(int start, int amount) { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeByte(3, 0)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 1)).ToArray(); bytes = bytes.Concat(JceStruct.writeLong(API.QQ.LongQQ, 2)).ToArray(); if (start == 0) { bytes = bytes.Concat(JceStruct.writeZero(3)).ToArray(); } else { bytes = bytes.Concat(JceStruct.writeByte((byte)start, 3)).ToArray(); } bytes = bytes.Concat(JceStruct.writeByte((byte)amount, 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(5)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 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.writeByte(1, 10)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(16, 11)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 12)).ToArray(); Dictionary <object, object> dic = new Dictionary <object, object>() { { "FL", bytes } }; bytes = JceStruct.writeMap(dic, 0); bytes = Pack_HeadJce(API.QQ.mRequestID, "mqq.IMService.FriendListServiceServantObj", "GetFriendListReq", bytes); //Debug.Print("GetFriendList" + Environment.NewLine + BitConverter.ToString(bytes).Replace("-", " ")) bytes = API.PackCmdHeader("friendlist.getFriendGroupList", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); return(bytes); }
public static byte[] GetGroupList(long thisQQ) { var bytes = JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_BEGIN, 0); bytes = bytes.Concat(JceStruct.writeLong(thisQQ, 0)).ToArray(); bytes = bytes.Concat(JceStruct.writeZero(1)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(1, 4)).ToArray(); bytes = bytes.Concat(JceStruct.writeByte(5, 5)).ToArray(); bytes = bytes.Concat(JceStruct.writeFlag(JceStruct.JceType.TYPE_STRUCT_END, 6)).ToArray(); Dictionary <object, object> dic = new Dictionary <object, object>() { { "GetTroopListReqV2", bytes } }; bytes = JceStruct.writeMap(dic, 0); bytes = Pack_HeadJce(API.QQ.mRequestID, "mqq.IMService.FriendListServiceServantObj", "GetTroopListReqV2", bytes); bytes = API.PackCmdHeader("friendlist.GetTroopListReqV2", bytes); bytes = API.PackAllHeader(bytes); API.TClient.SendData(bytes); return(bytes); }
public static void SendFriendPic(long thisQQ, long sendQQ, byte[] picBytes) { var picMd5 = API.MD5Hash(picBytes); API.FileHash = picMd5; API.FileBytes = picBytes; SendPicMsgStruct PicInfo = new SendPicMsgStruct { Amount = 1, PicType = 3, PicInfo = new PicInfos { SendQQ = sendQQ, StartFlag = 0, PicHash = picMd5, PicLengh = picBytes.Length, PicName = API.HashMD5(picBytes) + ".jpg", Field7 = 5, Field8 = 9, Field10 = 0, Field12 = 1, Field13 = 0, PicWidth = 647, PicHeigh = 980, PicPix = 1000, PicVer = "7.9.8.999", Field21 = 0, Field22 = 0 } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, PicInfo); var bytes = API.PackCmdHeader("LongConn.OffPicUp", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static bool MakeReadedFriendMsg(long qqfromid, byte[] SyncCoookies, long MsgTimeStamp) { MakeReadedFriendMessage ReadedMsg = new MakeReadedFriendMessage { ReadedMsg = new ReadedFriendMsg { QQFromInfo = new QQFromInfos { QQFromId = qqfromid, RecvTime = MsgTimeStamp }, SyncCoookie = SyncCoookies } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, ReadedMsg); var bytes = API.PackCmdHeader("PbMessageSvc.PbMsgReadedReport", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } return(true); }
public static void SendGroupAudio(long thisQQ, long sendQQ, long groupId, byte[] AudioBytes) { using (var audioStream = new MemoryStream(AudioBytes)) { AudioBytes = audioStream.ToArray(); } API.FileHash = API.MD5Hash(AudioBytes); SendGroupAudioMsgStruct AudioInfo = new SendGroupAudioMsgStruct { AudioType = 3, Field2 = 3, GroupAudioInfo = new GroupAudioInfos { GroupId = groupId, SendQQ = sendQQ, StartFlag = 0, AudioHash = API.FileHash, AudioSize = AudioBytes.Length, AudioName = API.HashMD5(AudioBytes) + ".amr", Field7 = 5, Field8 = 9, Field9 = 3, AudioVer = "7.9.8.999", Field12 = 1, Field13 = 1, Field14 = 1, Field15 = 1 } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, AudioInfo); var bytes = API.PackCmdHeader("PttStore.GroupPttUp", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static void SendGroupPic(long thisQQ, long sendQQ, long groupId, byte[] picBytes) { var picMd5 = API.MD5Hash(picBytes); API.FileHash = picMd5; API.FileBytes = picBytes; SendGroupPicMsgStruct PicInfo = new SendGroupPicMsgStruct { Amount = 1, PicType = 3, GroupPicInfo = new GroupPicInfos { GroupId = groupId, SendQQ = sendQQ, StartFlag = 0, PicHash = picMd5, PicSize = picBytes.Length, PicName = API.HashMD5(picBytes) + ".jpg", Field7 = 5, Field8 = 9, Field9 = 1, PicWidth = 647, PicHeigh = 980, PicPix = 1000, PicVer = "7.9.8.999", Field15 = 1007, Field19 = 0 } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, PicInfo); var bytes = API.PackCmdHeader("ImgStore.GroupPicUp", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } }
public static string GetFriendAudioUrl(byte[] BytesIn, byte[] token) { BytesIn = BytesIn.Skip(4).ToArray(); SendAudioMsgStruct GetAudioInfo = new SendAudioMsgStruct { AudioType = 1200, Field2 = 0, GetAudioInfo = new GetAudioInfos { thisQQ = API.QQ.LongQQ, token = token }, Field101 = 17, Field102 = 104, AudioOtherInfo = new AudioOtherInfos { Field1 = 3, Field2 = 104, Field90300 = 0, Field90700 = 0, Field91100 = 1 } }; using (var mStream = new MemoryStream()) { Serializer.Serialize(mStream, GetAudioInfo); Debug.Print("构造语音:" + "\r\n" + BitConverter.ToString(mStream.ToArray()).Replace("-", " ")); var bytes = API.PackCmdHeader("PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_DOWNLOAD-1200", mStream.ToArray()); API.TClient.SendData(API.PackAllHeader(bytes)); } ///上传语音 //var url = "http://" + sAddr + "/?ver=2&ukey=" + BitConverter.ToString(uKey).Replace("-", "") + "&filekey=" + BitConverter.ToString(filekey).Replace("-", "") + "&filesize=" + fileSize.ToString() + "&bmd5=" + BitConverter.ToString(filekey).Replace("-", "") + "&range=0&Audio_codec=1&mType=pttCu"; //Dictionary<string, object> Headerdics = new Dictionary<string, object>() //{ // {"User-Agent", "Dalvik/2.1.0 (Linux; U; Android 5.0; SM-G9009D Build/LRX21T"}, // {"Content-Type", "application/x-www-form-urlencoded"}, // {"Host", sAddr} //}; //var res = HttpHelper.HttpClientPostAsync2(url, Headerdics, fileByte, "application/x-www-form-urlencoded", mycookiecontainer, RedirectUrl).Result; using (var ms = new MemoryStream(BytesIn)) { var result = Serializer.Deserialize <AudioHashStruct>(ms); var sAddr = result.AudioUrlInfo.AudioUrl.IP; var Port = result.AudioUrlInfo.AudioUrl.Port; var url = result.AudioUrlInfo.AudioUrl.Url; //取语音 Dictionary <string, object> Headerdics = new Dictionary <string, object>() { { "User-Agent", "Dalvik/2.1.0 (Linux; U; Android 5.0; SM-G9009D Build/LRX21T" }, { "Content-Type", "application/x-www-form-urlencoded" }, { "Host", sAddr } }; var res = HttpHelper.HttpClientGetAsync(url, Headerdics, API.mycookiecontainer, API.RedirectUrl).Result; return(res); } return(""); }
public static bool SendFriendAudio(long thisQQ, long sendQQ, byte[] BytesIn, byte[] filekey) { byte[] bytes = null; List <byte[]> ListBytes = new List <byte[]>(); ListBytes.Add(new byte[] { 0x4A, 0x2, 0x28, 0x0 }); ListBytes.Add(new byte[] { 0xAA, 0x2, 0x3, 0x88, 1, 0 }); byte[] array = ListBytes.SelectMany((a) => a).ToArray(); BytesIn = BytesIn.Skip(4).ToArray(); using (var ms = new MemoryStream(BytesIn)) { var result = Serializer.Deserialize <AudioHashStruct>(ms); var sAddr = result.AudioHashInfo.IP; var Port = result.AudioHashInfo.Port; var uKey = result.AudioHashInfo.ukey; var token = result.AudioHashInfo.token; SendAudioInfos msg = new SendAudioInfos { Field1 = 4, thisQQ = thisQQ, token = "[Audio,hash=" + BitConverter.ToString(filekey).Replace("-", "") + ",token=" + Encoding.UTF8.GetString(token) + "]", AudioHash = filekey, AudioName = BitConverter.ToString(filekey).Replace("-", "") + ".amr", AudioSize = 6390, uKey = new byte[] { 0x3, 0x8, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1, 0x9, 0x0, 0x4, 0x0, 0x0, 0x0, 0x5, 0xA, 0x0, 0x2, 0x8, 0x0 }, Field9 = 3030587005, Port = 80, Field11 = 1 }; using (MemoryStream mStream = new MemoryStream()) { Serializer.Serialize(mStream, msg); bytes = mStream.ToArray(); Debug.Print("发送好友语音结构:" + bytes.Length.ToString() + "\r\n" + BitConverter.ToString(bytes).Replace("-", " ")); } SendFriendMsgStuct SendMsg = new SendFriendMsgStuct { SendFromInfo = new SendQQFrom { FromInfo = new FromInfos { FromId = sendQQ } }, MsgId = new byte[] { 8, 1, 0x10, 0, 0x18, 0 }, MsgInfo = new MsgInfos { MsgTextInfo = new MsgTextInfos { MsgContent = array, AudioContent = bytes } }, RequestId = API.QQ.mRequestID, TimeStamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)), SyncCoookie = new SyncCoookies { timestamp2 = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)), Field5 = 1634440201, Field6 = 916698971, Field7 = 2800362740, Field10 = 0 } }; using (var mStream = new MemoryStream()) { Serializer.Serialize(mStream, SendMsg); Debug.Print("发送好友语音消息:" + mStream.ToArray().Length.ToString() + "\r\n" + BitConverter.ToString(mStream.ToArray()).Replace("-", " ")); var SendBytes = API.PackCmdHeader("MessageSvc.PbSendMsg", mStream.ToArray()); API.TClient.SendData(API.PackAllHeader(SendBytes)); } } return(true); }
public static API.FriendWithdrawInfo SendFriendMsg(long thisQQ, long sendQQ, byte[] MsgBytes, API.MsgType MsgTypes) { byte[] bytes = null; List <TextMessageContents> MsgList = new List <TextMessageContents>(); List <byte[]> ListBytes = new List <byte[]>(); var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); if (MsgTypes == API.MsgType.TextMsg) //文字消息 { TextMessageContents MsgListStruct = new TextMessageContents { content = Encoding.UTF8.GetString(MsgBytes) }; MsgList.Add(MsgListStruct); MessageStruct msg = new MessageStruct { TextMessageContent = MsgList }; using (MemoryStream mStream = new MemoryStream()) { Serializer.Serialize(mStream, msg); bytes = mStream.ToArray(); } } else if (MsgTypes == API.MsgType.XmlMsg) { TextMessageContents MsgListStruct = new TextMessageContents { XmlContent = new XmlContents { Content = MsgBytes, flag = 1 } }; MsgList.Add(MsgListStruct); MessageStruct msg = new MessageStruct { TextMessageContent = MsgList }; using (MemoryStream mStream = new MemoryStream()) { Serializer.Serialize(mStream, msg); bytes = mStream.ToArray(); } } else if (MsgTypes == API.MsgType.PicMsg) //图片消息 { MsgBytes = MsgBytes.Skip(4).ToArray(); try { using (var ms = new MemoryStream(MsgBytes)) { var result = Serializer.Deserialize <PicGuidStruct>(ms); if (result.PicGuidInfo.uKey != null) //服务器没有该图片的hash { var uKey = result.PicGuidInfo.uKey; var Ip = API.Int32ToIP(result.PicGuidInfo.Ip[0]); var Port = result.PicGuidInfo.Port[0]; UploadFriendPicByTCP(sendQQ, uKey, Ip, Port); } SendFriendPicStruct msg = new SendFriendPicStruct { SendFriendPicInfo = new SendFriendPicInfos { PicName = BitConverter.ToString(API.FileHash).Replace("-", "") + ".jpg", PicHash = API.FileHash, PicGuid = result.PicGuidInfo.PicGuid, PicPix = 1000, PicWidth = 647, PicHeigh = 980 } }; using (MemoryStream mStream = new MemoryStream()) { Serializer.Serialize(mStream, msg); bytes = mStream.ToArray(); } } } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } } ListBytes.Add(bytes); SendFriendMsgStuct SendMsg = new SendFriendMsgStuct { SendFromInfo = new SendQQFrom { FromInfo = new FromInfos { FromId = sendQQ } }, MsgId = new byte[] { 8, 1, 0x10, 0, 0x18, 0 }, MsgInfo = new MsgInfos { MsgTextInfo = new MsgTextInfos { MsgContent = bytes } }, RequestId = API.QQ.mRequestID, TimeStamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)), count = 1, SyncCoookie = new SyncCoookies { timestamp1 = timestamp, timestamp2 = timestamp, timestamp3 = timestamp, Field3 = 805979870, Field4 = 3344460674, Field5 = 82343012, Field6 = 3281833389, Field7 = 2696570484, Field8 = 81, Field10 = 0 } }; API.FriendWithdraw.MsgReqId = API.QQ.mRequestID; API.FriendWithdraw.MsgTimeStamp = SendMsg.TimeStamp; API.FriendWithdraw.MsgRandomId = SendMsg.TimeStamp; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, SendMsg); Debug.Print("发送好友消息:" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", " ")); var SendBytes = API.PackCmdHeader("MessageSvc.PbSendMsg", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(SendBytes)); } return(API.FriendWithdraw); }
public static API.GroupWithdrawInfo SendGroupAudio(byte[] BytesIn, byte[] filekey) { var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); List <SendMessages> MsgList = new List <SendMessages>(); BytesIn = BytesIn.Skip(4).ToArray(); using (var ms = new MemoryStream(BytesIn)) { var result = Serializer.Deserialize <GroupAudioHashStruct>(ms); var sAddr = API.Int32ToIP(result.GroupAudioHashInfo.IP); var Port = result.GroupAudioHashInfo.Port; var uKey = result.GroupAudioHashInfo.ukey; var token = result.GroupAudioHashInfo.token; SendGroupMsgInfos msg = new SendGroupMsgInfos { SendGroupMsg = new SendGroupMsgs { SendGroupAudioInfo = new SendGroupAudioInfos { Field1 = 4, AudioHash = filekey, AudioName = BitConverter.ToString(filekey).Replace("-", "") + ".amr", AudioSize = 4590, uKey = new byte[] { 0x16, 0x36, 0x20, 0x38, 0x36, 0x65, 0x41, 0x31, 0x4, 0x34, 0x38, 0x36, 0x34, 0x63, 0x32, 0x33, 0x63, 0x62, 0x34, 0x61, 0x33, 0x31, 0x36, 0x31, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35, 0x30, 0x1A, 0x88, 0xF9, 0x2C, 0x88, 0x4D, 0xB1, 0xF5, 0xC, 0xB1, 0x5B, 0x33, 0xF8, 0xFA, 0x10, 0x6D, 0x31, 0x41, 0x38, 0x38, 0x46, 0x39, 0x32, 0x43, 0x38, 0x38, 0x34, 0x44, 0x42, 0x31, 0x46, 0x35, 0x30, 0x43, 0x42, 0x31, 0x35, 0x42, 0x33, 0x33, 0x46, 0x38, 0x46, 0x41, 0x31, 0x30, 0x36, 0x44, 0x2E, 0x61, 0x6D, 0x72, 0x41 }, IP = 1214562876, Field9 = 3030586896, Port = 80, Field11 = 1, token = token, Field19 = 0, AudioUrl = "/?ver=0&rkey=3062020101045b3059020101020101020416525dfe042439306a33676f4e4551795062466248363843666238536b49525067497264332357336872020457f8edde041f0000000866696c6574797065000000013100000005636f64656300000001310400&filetype=1&voice_codec=1", Field29 = 1, Field30 = new AudioUnKnownInfos { Field1 = 0 } } } }; SendGroupMsgStuct SendGroupMessage = new SendGroupMsgStuct { GroupInformation = new GroupInformations { GroupFrom = new GroupFroms { GroupId = API.GroupId } }, GroupMsgId = new byte[] { 8, 1, 0x10, 0, 0x18, 0 }, SendGroupMsgInfo = msg, MsgReqId = API.QQ.mRequestID, MsgRandomId = 0x10000000 + API.QQ.mRequestID, Groupcount = 1 }; API.GroupWithdraw.MsgReqId = API.QQ.mRequestID; API.GroupWithdraw.MsgRandomId = SendGroupMessage.MsgRandomId; using (var mStream = new MemoryStream()) { Serializer.Serialize(mStream, SendGroupMessage); Debug.Print("发送群语音消息:" + mStream.ToArray().Length.ToString() + "\r\n" + BitConverter.ToString(mStream.ToArray()).Replace("-", " ")); var SendBytes = API.PackCmdHeader("MessageSvc.PbSendMsg", mStream.ToArray()); API.TClient.SendData(API.PackAllHeader(SendBytes)); } //上传群语音 //var url = "http://" + sAddr + "/?ver=4679&ukey=" + BitConverter.ToString(uKey).Replace("-", "") + "&filekey=" + BitConverter.ToString(filekey).Replace("-", "") + "&filesize=" + fileSize.ToString() + "&range=0&bmd5=" + BitConverter.ToString(filekey).Replace("-", "") + "&mType=pttGu&Audio_codec=1"; //Dictionary<string, object> Headerdics = new Dictionary<string, object>() //{ // {"Accept-Encoding", "identity"}, // {"User-Agent", "Dalvik/2.1.0 (Linux; U; Android 5.0; SM-G9009D Build/LRX21T"}, // {"Content-Type", "application/x-www-form-urlencoded"}, // {"Host", sAddr} //}; //var res = HttpClientPostAsync2(url, Headerdics, fileByte, "application/x-www-form-urlencoded", mycookiecontainer, RedirectUrl).Result; } return(API.GroupWithdraw); }
public static API.GroupWithdrawInfo SendGroupMsg(long thisQQ, long GroupId, byte[] MsgBytes, API.MsgType MsgTypes, long sendQQ = 0) { byte[] bytes = null; var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); List <SendMessages> MsgList = new List <SendMessages>(); if (MsgTypes == API.MsgType.TextMsg) //文字消息 { SendMessages MsgListStruct = new SendMessages { SendContent = new SendContents { Content = Encoding.UTF8.GetString(MsgBytes) } }; if (sendQQ != 0) { SendMessages MsgListAtStruct = new SendMessages { SendContent = new SendContents { Content = "@" + sendQQ.ToString(), AtHash = new byte[] { 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x2, 0x3B, 0xD7, 0x86, 0x0, 0x0 } } }; MsgList.Add(MsgListAtStruct); } MsgList.Add(MsgListStruct); } else if (MsgTypes == API.MsgType.XmlMsg) { SendMessages MsgListStruct = new SendMessages { GroupXmlMsg = new GroupXmlContents { Content = MsgBytes, flag = 1 } }; SendMessages XmlFlagStruct = new SendMessages { GroupXmlFlag = new GroupXmlFlags { BuddleID = (new Random()).Next(1000001, 1000037) } }; MsgList.Add(MsgListStruct); MsgList.Add(XmlFlagStruct); } else if (MsgTypes == API.MsgType.PicMsg) //图片消息 { MsgBytes = MsgBytes.Skip(4).ToArray(); using (var ms = new MemoryStream(MsgBytes)) { var result = Serializer.Deserialize <GroupPicGuidStruct>(ms); if (result.GroupPicGuidInfo.uKey != null) //'服务器没有该图片的hash { var uKey = result.GroupPicGuidInfo.uKey; var Ip = API.Int32ToIP(result.GroupPicGuidInfo.Ip[0]); var Port = result.GroupPicGuidInfo.Port[0]; UploadGroupPicByTCP(sendQQ, GroupId, uKey, Ip, Port); } SendMessages msg = new SendMessages { SendGroupPicInfo = new SendGroupPicInfos { PicName = BitConverter.ToString(API.FileHash).Replace("-", "") + ".jpg", PicId1 = 3013326518, PicId2 = 1883293792, picIconWidth = 80, picIconHeigh = 66, picMD5 = "VdcrgQM3T3AaJPtM", picAmount = 1, picHash = API.FileHash, picType = 4, picPix = 1000, picWidth = 100, picHeigh = 104, picSize = 2500, Field26 = 0, Field29 = 0, Field30 = 0 } }; MsgList.Add(msg); } } SendGroupMsgStuct SendGroupMessage = new SendGroupMsgStuct { GroupInformation = new GroupInformations { GroupFrom = new GroupFroms { GroupId = GroupId } }, GroupMsgId = new byte[] { 8, 1, 0x10, 0, 0x18, 0 }, SendGroupMsgInfo = new SendGroupMsgInfos { SendGroupMsg = new SendGroupMsgs { SendMessage = MsgList } }, MsgReqId = API.QQ.mRequestID, MsgRandomId = (new Random()).Next(1, 1879048191) + 268435457, Groupcount = 0 }; API.GroupWithdraw.MsgReqId = API.QQ.mRequestID; API.GroupWithdraw.MsgRandomId = SendGroupMessage.MsgRandomId; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, SendGroupMessage); Debug.Print("发送群消息:" + ms.ToArray().Length.ToString() + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", " ")); var SendBytes = API.PackCmdHeader("MessageSvc.PbSendMsg", ms.ToArray()); API.TClient.SendData(API.PackAllHeader(SendBytes)); } return(API.GroupWithdraw); }