def FriendGroupList(data): list = [] value = data[7] friend_count = data[6] jce = JceInputStream(value) for item in range(friend_count): dict = {} jce.getHex(2) #0A dict['friendUin'] = jce.ReadNumber() dict['groupId'] = jce.ReadByte() dict['faceId'] = jce.ReadShort() dict['name'] = jce.ReadString() dict['sqqtype'] = jce.ReadByte() dict['status'] = jce.ReadByte() dict['memberLevel'] = jce.ReadByte() dict['isMqqOnLine'] = jce.ReadByte() dict['sqqOnLineState'] = jce.ReadByte() dict['isIphoneOnline'] = jce.ReadByte() dict['detalStatusFlag'] = jce.ReadByte() dict['sqqOnLineStateV2'] = jce.ReadByte() dict['sShowName'] = jce.ReadString() jce.ReadByte() dict['nickname'] = jce.ReadString() jce.getHex(2) #0B list.append(dict) return list
def AddFriendSetting(data): jce = JceInputStream(data) my_qqnumber = jce.ReadNumber() add_qqnumber = jce.ReadNumber() verify_type = jce.ReadByte() COUNT = jce.ReadList() if COUNT == 1: p = jce.data[2:] question = jce.ReadString() else: question = '' return [my_qqnumber, add_qqnumber, verify_type, question]
def Un_friendlistgetTroopMemberList(data): GroupMemberInfo = [] data = data[8:] jce = JceInputStream(data) jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadNumber() jce.ReadString() jce.ReadString() jce.getHex(4) LONG = jce.ReadValue() jce.data = jce.getHex(LONG * 2) jce.getHex(6) jce.ReadString() jce.getHex(4) LONG1 = jce.ReadValue() jce.data = jce.getHex(LONG1 * 2) jce.data = re.findall('^0a(.*?)0b$', jce.data)[0] jce.ReadNumber() jce.ReadNumber() jce.ReadNumber() jce.getHex(2) CONT = int(jce.getHex(4), 16) for item in range(CONT): jce.getHex(2) #0A GroupMemberNumber = jce.ReadNumber() jce.ReadByte() GroupMemberAge = jce.ReadByte() Gender = jce.ReadByte() if Gender == 1: GroupMemberGender = 'Female' elif Gender == 0: GroupMemberGender = 'Male' else: GroupMemberGender = 'Unknown' GroupMemberNickName = jce.ReadString() jce.ReadByte() jce.ReadString() GroupMemberRemarkName = jce.ReadString() jce.ReadByte() jce.ReadString() jce.ReadString() jce.ReadString() jce.ReadString() jce.ReadByte() jce.ReadNumber() jce.ReadNumber() jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadString() jce.ReadByte() jce.ReadString() jce.ReadByte() jce.ReadByte() jce.getHex(2) #0b GroupMemberInfo.append({ 'GroupMemberNumber': GroupMemberNumber, 'GroupMemberAge': GroupMemberAge, 'GroupMemberGender': GroupMemberGender, 'GroupMemberNickName': GroupMemberNickName, 'GroupMemberRemarkName': GroupMemberRemarkName }) return GroupMemberInfo
def Un_FriendListGetTroopListReqV2(data): GroupInfoList = [] data = data[8:] print data jce = JceInputStream(data) jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadShort() jce.ReadString() jce.ReadString() jce.getHex(4) long = jce.ReadValue() jce.data = jce.data[:long * 2] jce.getHex(6) jce.ReadString() jce.getHex(4) long2 = jce.ReadValue() jce.data = jce.data[:long2 * 2] print jce.data jce.data = re.findall('^0a(.*?)0b$', jce.data)[0] jce.ReadNumber() jce.ReadByte() jce.ReadByte() jce.ReadByte() jce.ReadValue() jce.getHex(2) cont = jce.ReadValue() print cont print jce.data for item in range(cont): jce.ReadValue() #0a GroupCode = jce.ReadValue() #code GroupNumber = jce.ReadValue() jce.ReadValue() jce.ReadValue() GroupName = jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() jce.ReadValue() #0b GroupInfoList.append({ 'GroupCode': GroupCode, 'GroupName': GroupName, 'GroupNumber': GroupNumber }) return GroupInfoList