def AutoReceiveFriends(self, targetQQ): if config.AutoAgreeAddFriend == True: data = Packet.Pack_friendlistGetAutoInfoReq(self, targetQQ) self.FunSend(Coder.hexstr2str(data)) time.sleep(1) data1 = Packet.Pack_ProfileServicePbReqSystemMsgActionFriend( self, targetQQ) self.FunSend(Coder.hexstr2str(data1))
def SendFriendImageMsg(self, targetQQ, ImgName, ImgPath): ImaFileName = ImgName + '.jpg' data = Packet.SendImageMsg(self, '', targetQQ, ImgName, ImaFileName, ImgPath) self.FunSend(Coder.hexstr2str(data))
def SendGroupMemberImageMsg(self, GroupQQ, targetQQ, ImgName, ImgPath): #GroupQQ = '574240651' #targetQQ = '296603528' #ImgName = '936ee06bd035095c991c5a2572614ae4' ImaFileName = ImgName + '.jpg' #ImgPath = '/7b9da5a3-8b5b-462f-a03c-eb9c6f37ebb8A' data = Packet.SendImageMsg(self, GroupQQ, targetQQ, ImgName, ImaFileName, ImgPath) self.FunSend(Coder.hexstr2str(data))
def AutoReceiveAddGroup(self, targetQQ, GroupNumber): if config.AutoAgreeGroup == True: # data = Packet.ProfileServicePbReqSystemMsgNewGroup(self) # self.FunSend(Coder.hexstr2str(data)) # data1 = Packet.Pack_GetSimpleInfo(self,targetQQ) # self.FunSend(Coder.hexstr2str(data1)) # data2 = Packet.Pack_ProfileServicePbReqSystemMsgActionGroup(self,targetQQ,GroupNumber) # self.FunSend(Coder.hexstr2str(data2)) data = Packet.Pack_AutoReceiveGroupRequests( self, targetQQ, GroupNumber) self.FunSend(Coder.hexstr2str(data))
def GroupRemovesMember(self, targetQQ, GroupNumber): data = Packet.Pack_GroupRemovesMember(self, targetQQ, GroupNumber) self.FunSend(Coder.hexstr2str(data))
def getFriendGroupList(self): value = Packet.Pack_friendlist_getFriendGroupList(self, 0, 20) self.FunSend(Coder.hexstr2str(value))
def GetGroupManager(self, GroupNumbar): data = Packet.Pack_ProfileServiceReqBatchProcess(self, GroupNumbar) self.FunSend(Coder.hexstr2str(data))
def SetGroupCardName(self, name, groupname): data = Packet.Pack_friendlistModifyGroupCardReq(self, name, groupname) self.FunSend(Coder.hexstr2str(data))
def SendGroupMsg(self, qqgroup_number, msg): data = Packet.Pack_MessageSvc_SendGroupMsg(self, qqgroup_number, msg) self.FunSend(Coder.hexstr2str(data))
def AddGroup(self, addgroupnum, msg): data = Packet.Pack_ProfileService_GroupMngReq(self, addgroupnum, msg) self.FunSend(Coder.hexstr2str(data))
def Addfriend(self, addqqnum, msg): self.Addvalidation = msg data = Packet.Pack_friendlist_getUserAddFriendSetting(self, addqqnum) self.FunSend(Coder.hexstr2str(data))
def sendMsg(self, qqnumber, text): data = Packet.Pack_MessageSvc_offlinemsg(self, qqnumber, text) self.FunSend(Coder.hexstr2str(data))
def getGroupList(self): """ 获取群列表 """ req = Packet.Pack_FriendListService_GetTroopListReqV2(self) self.FunSend(Coder.hexstr2str(req))
def GetQzoneAppList(self, targetQQ): data = Packet.Pack_QzoneNewService_getApplist(self, targetQQ) self.FunSend(Coder.hexstr2str(data))
def GetNearPeople(self, longitude, latitude): long = int(str(longitude * 1000000)[:9]) lat = int(str(latitude * 1000000)[:8]) data = Packet.Pack_EncounterSvc_ReqGetEncounter(self, long, lat) self.FunSend(Coder.hexstr2str(data))
def AddfriendGroup(self, name): data = Packet.Pack_friendlistSetGroupReq(self, name) self.FunSend(Coder.hexstr2str(data))
def GetfriendWidget(self): data = Packet.Pack_QzoneNewService_getWidget(self) self.FunSend(Coder.hexstr2str(data))
def GetGroupInfo(self, GroupNumber): data = Packet.Pack_FriendListServiceServantObj_GetTroopMemberListReq( self, GroupNumber) self.FunSend(Coder.hexstr2str(data))
def GetSearchkey(self, key): data = Packet.Pack_SummaryCardServantObj_ReqCondSearch(self, key) self.FunSend(Coder.hexstr2str(data))
def GetQQnumber(self, phone): data = Packet.Pack_SummaryCardReqSummaryCard(self, phone, self.qqnum) print data self.FunSend(Coder.hexstr2str(data))
def unpack(self, cmd, data): if cmd == 'OidbSvc.0x7a2_0': pass elif cmd == 'StatSvc.register': print '上线成功!' wx.CallAfter(self.window.log, u'[' + self.qqnum + u']--登录成功!') elif cmd == 'StatSvc.get': print '心跳包' wx.CallAfter(self.window.log, u'心跳包') elif cmd == 'ConfigPushSvc.PushDomain': print data elif cmd == 'ConfigPushSvc.PushReq': pass elif cmd == 'MessageSvc.PushNotify': print '您有新的消息' self.getmessage() #wx.CallAfter(self.window.log,u'你有新的消息') #self.FunSend(Coder.hexstr2str(self.Pack_MessageSvc_offlinemsg(296603528,'123'))) elif cmd == 'MessageSvc.PushReaded': print '在其他地方查看此消息了' #wx.CallAfter(self.window.log,u'在其他地方查看此消息了') elif cmd == 'friendlist.getFriendGroupList': print data list = UnPacket.Un_friendlistgetFriendGroupList(data) self.friendlist = list wx.CallAfter( self.window.log, u'################' + u'共获取到' + str(len(self.friendlist)) + u'个好友' + u'################') print '################', '共获取到' + str(len( self.friendlist)) + '个好友', '################' for item in self.friendlist: a = u'qq号 :“' + str( item['friendUin']) + u'” 昵称 :“' + item['name'] + u'”' wx.CallAfter(self.window.log, a) elif cmd == 'OnlinePush.PbC2CMsgSync': print data elif cmd == 'MessageSvc.PbGetMsg': print data Msglist = UnProtobuf.UnMessageSvcPbGetMsg(data) for item in Msglist: if not item['MsgID'] in self.friendMsgIDList: self.Msgprocessing(item) self.friendMsgIDList.append(item['MsgID']) elif cmd == 'OnlinePush.PbPushGroupMsg': dict = UnProtobuf.UnOnlinePushPbPushGroupMsg(data) if not dict['MsgID'] in self.GroupMsgIDList: self.GroupMsgIDList.append(dict['MsgID']) wx.CallAfter( self.window.log, str(dict['groupQQ']) + u'[' + dict['groupnickname'] + u']' + u'-群消息:' + str(dict['targetQQ']) + u'[' + dict['targetnickname'] + u']' + u'说:' + dict['message']) elif cmd == 'MessageSvc.offlinemsg': print '发送成功' elif cmd == 'FriendList.GetTroopListReqV2': self.GroupInfoLsit = UnPacket.Un_FriendListGetTroopListReqV2(data) print self.GroupInfoLsit a = u'################ 共获取到' + str(len( self.GroupInfoLsit)) + u'个群 ################' print a wx.CallAfter(self.window.log, a) for item in self.GroupInfoLsit: retmsg = u'qq群号:“' + str( item['GroupNumber']) + u'” qq群名称:“' + str( item['GroupName']) + u'” qq群Code:“' + str( item['GroupCode']) + u'”' print retmsg wx.CallAfter(self.window.log, retmsg) elif cmd == 'friendlist.getUserAddFriendSetting': print data [my_qqnumber, add_qqnumber, verify_type, question] = UnPacket.Un_Pack_RequestPacket(data) if verify_type == 0 or verify_type == 1: req = Packet.Pack_AddFriendReq(self, my_qqnumber, add_qqnumber, verify_type, self.Addvalidation) self.FunSend(Coder.hexstr2str(req)) elif verify_type == 3: print '问题:' + question wx.CallAfter(self.window.log, u'需要回答问题:' + question) elif verify_type == 101: print '已经是好友了' wx.CallAfter(self.window.log, u'已经是好友了') elif cmd == 'SQQzoneSvc.getApplist': value = re.findall('73745d0001(.*?)6d0001', data) if value: print 'ret:', value else: print '目标设置了访问权限' elif cmd == 'friendlist.getTroopMemberList': print data self.GroupMemberInfo = UnPacket.Un_friendlistgetTroopMemberList( data) a = u'################' + u'共获取到' + str(len( self.GroupMemberInfo)) + u'个成员' + u'################' wx.CallAfter(self.window.log, a) for item in self.GroupMemberInfo: Member = u'成员QQ号:“' + str( item['GroupMemberNumber']) + u'” 年龄:“' + str( item['GroupMemberAge']) + u'” 性别:“' + str( item['GroupMemberGender']) + u'” 成员昵称:“' + item[ 'GroupMemberNickName'] + u'” 成员备注名:“' + item[ 'GroupMemberRemarkName'] + u'”' wx.CallAfter(self.window.log, Member) elif cmd == 'EncounterSvc.ReqGetEncounter': PeopleNearbyList = UnPacket.Un_EncounterSvcReqGetEncounter(data) elif cmd == 'ProfileService.ReqBatchProcess': pbdata = UnPacket.Un_ProfileServiceReqBatchProcess(data) retdata = UnProtobuf.UnGroupManager(pbdata) FounderQQ = retdata['FounderQQ'] print '群主QQ:' + FounderQQ ManagerQQList = retdata['ManagerQQList'] print '管理员QQ:' for item in ManagerQQList: print item elif cmd == 'OnlinePush.ReqPush': dict = UnPacket.Un_friendlistSetGroupReq(data) if dict: id = dict['id'] pbdata = dict['pbdata'] code = dict['code'] req = Packet.Pack_OnlinePushRespPush(self, id, pbdata, code) self.FunSend(Coder.hexstr2str(req)) else: print data