def packSendLoginTlv(self, verifyCode=None): if verifyCode == None: tlv = '' tlv += Coder.trim('00 09') tlv += Coder.trim('00 14') #tlv包个数 #tlv组包 tlv += Tlv.tlv18(self.uin) tlv += Tlv.tlv1(self.uin, self.server_time) print 'packSendLoginTlv tlv106 start ' + bytes(len(tlv)) tvl106 = Tlv.tlv106(self.uin, self.server_time, self.pwdMd5, self.tgtKey, self.imei, self.appId, self.pwdKey) tlv +=tvl106 print 'packSendLoginTlv tlv106 end ' + bytes(len(tlv)) tlv += Tlv.tlv116() tlv += Tlv.tlv100() tlv += Tlv.tlv107() tlv += Tlv.tlv144(self.tgtKey, self.imei, self.os_type, self.os_version, self.network_type, self.sim_operator_name, self.apn, self.device, self.device_product) tlv += Tlv.tlv142(self.package_name) tlv += Tlv.tlv145(self.imei) tlv += Tlv.tlv154(self.seq) tlv += Tlv.tlv141(self.sim_operator_name, self.network_type, self.apn) tlv += Tlv.tlv8() tlv += Tlv.tlv16b() tlv += Tlv.tlv147() tlv += Tlv.tlv177() tlv += Tlv.tlv187() tlv += Tlv.tlv188() tlv += Tlv.tlv191() tlv += Tlv.tlv194() tlv += Tlv.tlv202(self.wifi_name) print 'tvl106 index :' + bytes(tlv.find(tvl106)) + '----' + bytes(tlv.find(tvl106)+len(tvl106)) print 'packSendLoginTlv tlv :'+tlv tlv = TEA.entea_hexstr(tlv, self.shareKey) return tlv else: tlv = '' tlv += Coder.trim('00 02') tlv += Coder.trim('00 04') #tlv组包 tlv += Tlv.tlv2(verifyCode, self.verifyToken1) tlv += Tlv.tlv8() tlv += Tlv.tlv104(self.verifyToken2) tlv += Tlv.tlv116() tlv = TEA.entea_hexstr(tlv, self.shareKey) return tlv
def Pack_FriendListServiceServantObj_GetTroopMemberListReq(self, GroupNumber): msg = '' msg += Coder.trim( '00 00 00 2D 00 00 00 21 66 72 69 65 6E 64 6C 69 73 74 2E 67 65 74 54 72 6F 6F 70 4D 65 6D 62 65 72 4C 69 73 74 00 00 00 08 31 61 D2 53 00 00 00 7D' ) msg += Coder.trim( '10 03 2C 3C 42 2F 42 20 DF 56 29 6D 71 71 2E 49 4D 53 65 72 76 69 63 65 2E 46 72 69 65 6E 64 4C 69 73 74 53 65 72 76 69 63 65 53 65 72 76 61 6E 74 4F 62 6A 66 15 47 65 74 54 72 6F 6F 70 4D 65 6D 62 65 72 4C 69 73 74 52 65 71 7D 00 00 25 08 00 01 06 04 47 54 4D 4C 1D 00 00 18 0A 02' ) msg += Coder.qqnum2hexstr(self.qqnum) msg += Coder.trim('12') msg += Coder.qqnum2hexstr(GroupNumber) msg += Coder.trim('2C 33 00 00 00 00 9D 3F C2 21 40 02 0B 8C 98 0C A8 0C') data = TEA.entea_hexstr(msg, self.qqkey) data = TEA.entea_hexstr(msg, self.qqkey) return Pack(self, data, 2)
def Pack_QzoneNewService_getWidget(self): """ 未完成 :param self: :return: """ print Coder.qqnum2hexstr(self.qqnum) msg = '' msg += Coder.trim( '00 00 00 2C 00 00 00 20 53 51 51 7A 6F 6E 65 53 76 63 2E 67 65 74 4E 65 77 41 63 74 69 76 65 46 65 65 64 73 00 00 00 08 31 61 D2 53 00 00 01 CF 01 37 5D 12 00 0F 42 5B 22' ) msg += Coder.qqnum2hexstr(self.qqnum) msg += Coder.trim( '36 19 56 31 5F 41 4E 44 5F 53 51 5F 35 2E 37 2E 31 5F 32 35 38 5F 59 59 42 5F 44 46 21 51 7A 6F 6E 65 4E 65 77 53 65 72 76 69 63 65 2E 67 65 74 4E 65 77 41 63 74 69 76 65 46 65 65 64 73 56 75 69 3D 38 36 30 38 34 31 30 32 33 36 37 36 34 36 39 26 6D 61 63 3D 30 30 3A 31 36 3A 36 64 3A 66 30 3A 32 39 3A 63 36 26 6D 3D 38 31 39 30 51 26 6F 3D 34 2E 31 2E 32 26 61 3D 31 36 26 73 63 3D 31 26 73 64 3D 30 26 70 3D 35 34 30 2A 39 36 30 26 66 3D 59 75 4C 6F 6E 67 26 6E 3D 77 69 66 69 26 6C 6F 6E 67 69 74 75 64 65 3D 26 6C 61 74 69 74 75 64 65 3D 6A 00 40 1D 00 0C 28 00 01 00 01 1D 00 00 01 00 0B 7A 0C 1C 2C 3D 00 00 06 00 00 00 00 00 00 0B 8D 00 00 5A' ) p1 = Coder.trim( '08 00 02 06 09 67 65 74 57 69 64 67 65 74 18 00 01 06 1D 4E 53 5F 4D 4F 42 49 4C 45 5F 57 49 44 47 45 54 2E 47 65 74 57 69 64 67 65 74 52 65 71 1D 00 00 0D 0A 00 FF 12' ) p2 = '' p3 = Coder.trim( '20 08 36 00 0B 06 07 68 6F 73 74 75 69 6E 18 00 01 06 05 69 6E 74 36 34 1D 00 00 05 02' ) p4 = Coder.qqnum2hexstr(self.qqnum) msg += Coder.str2hexstr(zlib.compress(Coder.hexstr2str(p1 + p2 + p3 + p4))) msg += Coder.trim( '9D 00 00 3C 08 00 01 06 0B 62 75 73 69 43 6F 6D 70 43 74 6C 18 00 01 06 1B 51 4D 46 5F 50 52 4F 54 4F 43 41 4C 2E 51 6D 66 42 75 73 69 43 6F 6E 74 72 6F 6C 1D 00 00 08 0A 00 01 10 5D 20 01 0B AC BC CA 0C 1C 23 00 00' ) msg += '0' + Coder.qqnum2hexstr(int(time.time() * 1000)) + '0b' print msg return Pack(self, TEA.entea_hexstr(msg, self.qqkey), 2)
def tlv106(uin, server_time, pwdMd5, tgtKey, imei, appId, pwdKey): tlv = '' tlv += Coder.trim('00 03') tlv += Coder.genBytesHexstr(4) tlv += Coder.trim('00 00 00 05 00 00 00 10 00 00 00 00 00 00 00 00') tlv += uin tlv += server_time tlv += Coder.trim('00 00 00 00 01') tlv += pwdMd5 print 'tlv106 start len '+ bytes(len(tlv)) print 'tgtKey val:' +tgtKey tlv += tgtKey print 'tlv106 end len '+ bytes(len(tlv)) tlv += Coder.trim('00 00 00 00 01') tlv += imei tlv += appId tlv += Coder.trim('00 00 00 01') tlv += Coder.trim('00 00') print 'tlv106 val:'+tlv tlv = TEA.entea_hexstr(tlv, pwdKey) tlvlen = len(tlv) tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 06') + tlv print 'tlv title :'+Coder.trim('01 06') + Coder.num2hexstr(len(tlv)/2, 2) print 'tlv entea index :' + bytes(len(tlv) - tlvlen) +" end "+bytes(tlvlen) return tlv
def packSendLoginMessage(self, verifyCode=None): #MessageHead msgHeader = '' msgHeader += Coder.num2hexstr(self.seq+1, 4) msgHeader += self.appId msgHeader += self.appId msgHeader += Coder.trim('01 00 00 00 00 00 00 00 00 00 00 00') msgHeader += Coder.num2hexstr(len(self.extBin)/2+4, 4) + self.extBin msgHeader += Coder.num2hexstr(len(self.loginCmd)/2+4, 4) + self.loginCmd msgHeader += Coder.num2hexstr(len(self.msgCookies)/2+4, 4) + self.msgCookies msgHeader += Coder.num2hexstr(len(self.imei)/2+4, 4) + self.imei msgHeader += Coder.num2hexstr(len(self.ksid)/2+4, 4) + self.ksid msgHeader += Coder.num2hexstr(len(self.ver)/2+2, 2) + self.ver msgHeader = Coder.num2hexstr(len(msgHeader)/2+4, 4) + msgHeader #Message msg = '' msg += Coder.trim('1F 41') msg += Coder.trim('08 10 00 01') msg += self.uin msg += Coder.trim('03 07 00 00 00 00 02 00 00 00 00 00 00 00 00 01 01') msg += self.randomKey msg += Coder.trim('01 02') msg += Coder.num2hexstr(len(self.pubKey)/2, 2) + self.pubKey #TEA加密的TLV msg += self.packSendLoginTlv(verifyCode) msg += Coder.trim('03') msg = Coder.num2hexstr(len(msg)/2+2+1, 2) + msg msg = Coder.trim('02') + msg msg = Coder.num2hexstr(len(msg)/2+4, 4) + msg packet = msgHeader + msg packet = TEA.entea_hexstr(packet, self.defaultKey) return packet
def Pack_EncounterSvc_ReqGetEncounter(self, long, lat): """ 获取附近的人 """ # 0000002c00000020456e636f756e7465725376632e526571476574456e636f756e74657200000008844cd92b000001ff msg = '' msg += Coder.trim( '00 00 00 2C 00 00 00 20 45 6E 63 6F 75 6E 74 65 72 53 76 63 2E 52 65 71 47 65 74 45 6E 63 6F 75 6E 74 65 72 00 00 00 08 D7 1C 77 15 00 00 01 88' ) msg += Coder.trim('10 03 2C 3C 42') self.qq00001 = random.randint(10000000, 99999999) msg += str(self.qq00001) msg += Coder.trim( ' 56 0C 45 6E 63 6F 75 6E 74 65 72 4F 62 6A 66 13 43 4D 44 5F 47 45 54 5F 45 4E 43 4F 55 4E 54 45 52 56 32 7D 00 01 01 4E 08 00 02 06 09 52 65 71 48 65 61 64 65 72 1D 00 00 13 0A 00 02 12' ) msg += Coder.trim(Coder.qqnum2hexstr(self.qqnum)) msg += Coder.trim('22 20 02 9A A9 3C 40 02 5C 6C 0B 06 11') msg += Coder.trim( '52 65 71 47 65 74 45 6E 63 6F 75 6E 74 65 72 56 32 1D 00 01 01 11 0A 0A 0A 02' ) msg += Coder.num2hexstr(lat, 4) msg += Coder.trim('12') msg += Coder.num2hexstr(long, 4) msg += Coder.trim( '2C 30 01 0B 19 0C 29 0C 36 16 42 31 5F 51 51 5F 4E 65 69 67 68 62 6F 72 5F 61 6E 64 72 6F 69 64 46 08 4E 7A 56 4B 5F 71 47 45 5C 6C 0B 1A 0C 12 35 A4 E9 00 22 35 A4 E9 00 3C 4C 56 00 0B 20 00 30 FF 5D 00 00 01 00 6C 71 07 D0 80 FF 9C BD 00 00 72 00 00 00 72' ) msg += Coder.trim( '10 03 2C 3C 40 01 56 1C 50 75 62 41 63 63 6F 75 6E 74 53 76 63 2E 6E 65 61 72 62 79 5F 70 75 62 61 63 63 74 66 0E 6E 65 61 72 62 79 5F 70 75 62 61 63 63 74 7D 00 00 31 08 00 01 06 0E 6E 65 61 72 62 79 5F 70 75 62 61 63 63 74 1D 00 00 1A 0A 00 02 1D 00 0C 20 02 3A 0A 02 01 78 40 64 12 06 1D 64 AD 2C 30 01 0B 0B 0B 8C 98 0C A8 0C CC D0 00 EC FC 0F FC 10 F1 11 01 E0 FC 12 FC 13 FC 14 F0 15 00 FC 16 FA 17 0A 02 01 78 40 64 12 06 1D 64 AD 2C 30 01 0B 19 0C 29 0C 36 00 46 00 50 01 6C 0B F0 18 0F FD 19 00 0C FC 1A FC 1B 0B 8C 98 0C A8 0C' ) print msg data = TEA.entea_hexstr(msg, self.qqkey) return Pack(self, data, 2)
def Pack_SummaryCardServantObj_ReqCondSearch_again(self, message, n): alllong = Coder.num2hexstr(151 + len(message)) msglong = Coder.num2hexstr(len(message)) mainlong = Coder.num2hexstr(91 + len(message)) erlong = Coder.num2hexstr(52 + len(message)) COUNT = Coder.num2hexstr(n) msg = '' msg += Coder.trim( '00 00 00 29 00 00 00 1D 53 75 6D 6D 61 72 79 43 61 72 64 2E 52 65 71 43 6F 6E 64 53 65 61 72 63 68 00 00 00 08 E4 A7 76 B4 00 00 00' ) msg += alllong msg += Coder.trim( '10 03 2C 3C 42 7A 15 57 8D 56 15 53 75 6D 6D 61 72 79 43 61 72 64 53 65 72 76 61 6E 74 4F 62 6A 66 0D 52 65 71 43 6F 6E 64 53 65 61 72 63 68 7D 00 00' ) msg += mainlong msg += Coder.trim( '08 00 02 06 07 52 65 71 48 65 61 64 1D 00 00 04 0A 00 02 0B 06 0D 52 65 71 43 6F 6E 64 53 65 61 72 63 68 1D 00 00' ) msg += erlong msg += Coder.trim('0A 00') msg += COUNT msg += Coder.trim('10 01') msg += Coder.trim('20 01 36') msg += msglong msg += Coder.str2hexstr(message) msg += Coder.trim( '4C 5D 00 00 10 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 6C 7D 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 8C 98 0C A8 0C' ) data = TEA.entea_hexstr(msg, self.qqkey) return Pack(self, data, 2)
def Pack_QzoneNewService_getApplist(self, targetQQ): """ 获取指定qq号说说列表(完成) """ msg = '' msg += Coder.trim( '00 00 00 25 00 00 00 19 53 51 51 7A 6F 6E 65 53 76 63 2E 67 65 74 41 70 70 6C 69 73 74 00 00 00 08 71 72 5A A3 00 00 01 BE 02 00 00 C4 27 12 00 0F 42 5B 22' ) msg += Coder.qqnum2hexstr(self.qqnum) msg += Coder.trim( '36 19 56 31 5F 41 4E 44 5F 53 51 5F 35 2E 38 2E 30 5F 32 36 34 5F 59 59 42 5F 44 46 1A 51 7A 6F 6E 65 4E 65 77 53 65 72 76 69 63 65 2E 67 65 74 41 70 70 6C 69 73 74 56 75 69 3D 38 36 30 38 34 31 30 32 33 36 37 36 34 36 39 26 6D 61 63 3D 30 30 3A 31 36 3A 36 64 3A 66 30 3A 32 39 3A 63 36 26 6D 3D 38 31 39 30 51 26 6F 3D 34 2E 31 2E 32 26 61 3D 31 36 26 73 63 3D 31 26 73 64 3D 30 26 70 3D 35 34 30 2A 39 36 30 26 66 3D 59 75 4C 6F 6E 67 26 6E 3D 77 69 66 69 26 6C 6F 6E 67 69 74 75 64 65 3D 26 6C 61 74 69 74 75 64 65 3D 6A 00 40 1D 00 0C 28 00 01 00 01 1D 00 00 01 00 0B 7A 0C 1C 2C 3D 00 00 06 00 00 00 00 00 00 0B 8D 00 01 00 88' ) p1 = Coder.trim( '08 00 03 06 05 72 65 66 65 72 18 00 01 06 06 73 74 72 69 6E 67 1D 00 00 0D 06 0B 67 65 74 4D 61 69 6E 50 61 67 65 06 0A 67 65 74 41 70 70 6C 69 73 74 18 00 01 06 22 4E 53 5F 4D 4F 42 49 4C 45 5F 46 45 45 44 53 2E 6D 6F 62 69 6C 65 5F 61 70 70 6C 69 73 74 5F 72 65 71 1D 00 00 12 0A 02' ) p2 = Coder.qqnum2hexstr(targetQQ) p3 = Coder.trim( '11 01 37 20 0A 36 00 4C 50 01 6C 0B 06 07 68 6F 73 74 75 69 6E 18 00 01 06 05 69 6E 74 36 34 1D 00 00 05 02' ) p4 = Coder.qqnum2hexstr(self.qqnum) msg += Coder.str2hexstr(zlib.compress(Coder.hexstr2str(p1 + p2 + p3 + p4))) msg += Coder.trim( '9D 00 00 3D 08 00 01 06 0B 62 75 73 69 43 6F 6D 70 43 74 6C 18 00 01 06 1B 51 4D 46 5F 50 52 4F 54 4F 43 41 4C 2E 51 6D 66 42 75 73 69 43 6F 6E 74 72 6F 6C 1D 00 00 09 0A 00 01 11 00 8B 20 01 0B AC BC CA 0C 1C 23 00 00' ) msg += '0' + Coder.qqnum2hexstr(int(time.time() * 1000)) + '0b' data1 = TEA.entea_hexstr(msg, self.qqkey) return Pack(self, data1, 2)
def tlv144(tgtKey, imei, os_type, os_version, network_type, sim_operator_name, apn, device, device_product): tlv = '' tlv += Coder.trim('00 04') tlv += Tlv.tlv109(imei) tlv += Tlv.tlv124(os_type, os_version, network_type, sim_operator_name, apn) tlv += Tlv.tlv128(device, imei, device_product) tlv += Tlv.tlv16e(device) tlv = TEA.entea_hexstr(tlv, tgtKey) tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 44') + tlv return tlv
def Make_sendSsoMsg(self, cmd, bin): serviceCmd = Coder.str2hexstr(cmd) msg = '' msg += Coder.num2hexstr(len(serviceCmd) / 2 + 4, 4) + serviceCmd msg += Coder.num2hexstr(len(self.msgCookies2) / 2 + 4, 4) + self.msgCookies2 data = '' data += Coder.num2hexstr(len(msg) / 2 + 4, 4) + msg data += bin value = TEA.entea_hexstr(data, self.qqkey) return value
def packSendLoginTlv(self, verifyCode=None): if verifyCode == None: tlv = '' tlv += Coder.trim('00 09') tlv += Coder.trim('00 14') #tlv包个数 #tlv组包 tlv += Tlv.tlv18(self.uin) tlv += Tlv.tlv1(self.uin, self.server_time) tlv += Tlv.tlv106(self.uin, self.server_time, self.pwdMd5, self.tgtKey, self.imei, self.appId, self.pwdKey) tlv += Tlv.tlv116() tlv += Tlv.tlv100() tlv += Tlv.tlv107() tlv += Tlv.tlv144(self.tgtKey, self.imei, self.os_type, self.os_version, self.network_type, self.sim_operator_name, self.apn, self.device, self.device_product) tlv += Tlv.tlv142(self.package_name) tlv += Tlv.tlv145(self.imei) tlv += Tlv.tlv154(self.seq) tlv += Tlv.tlv141(self.sim_operator_name, self.network_type, self.apn) tlv += Tlv.tlv8() tlv += Tlv.tlv16b() tlv += Tlv.tlv147() tlv += Tlv.tlv177() tlv += Tlv.tlv187() tlv += Tlv.tlv188() tlv += Tlv.tlv191() tlv += Tlv.tlv194() tlv += Tlv.tlv202(self.wifi_name) tlv = TEA.entea_hexstr(tlv, self.shareKey) return tlv else: tlv = '' tlv += Coder.trim('00 02') tlv += Coder.trim('00 04') #tlv组包 tlv += Tlv.tlv2(verifyCode, self.verifyToken1) tlv += Tlv.tlv8() tlv += Tlv.tlv104(self.verifyToken2) tlv += Tlv.tlv116() tlv = TEA.entea_hexstr(tlv, self.shareKey) return tlv
def packSendLoginMessage(self, verifyCode=None): #MessageHead msgHeader = '' msgHeader += Coder.num2hexstr(self.seq, 4) msgHeader += self.appId msgHeader += self.appId msgHeader += Coder.trim('01 00 00 00 00 00 00 00 00 00 00 00') msgHeader += Coder.num2hexstr(len(self.extBin) / 2 + 4, 4) + self.extBin msgHeader += Coder.num2hexstr(len(self.loginCmd) / 2 + 4, 4) + self.loginCmd msgHeader += Coder.num2hexstr(len(self.msgCookies) / 2 + 4, 4) + self.msgCookies msgHeader += Coder.num2hexstr(len(self.imei) / 2 + 4, 4) + self.imei msgHeader += Coder.num2hexstr(len(self.ksid) / 2 + 4, 4) + self.ksid msgHeader += Coder.num2hexstr(len(self.ver) / 2 + 2, 2) + self.ver msgHeader = Coder.num2hexstr(len(msgHeader) / 2 + 4, 4) + msgHeader #Message msg = '' msg += Coder.trim('1F 41') msg += Coder.trim('08 10 00 01') msg += self.uin msg += Coder.trim('03 07 00 00 00 00 02 00 00 00 00 00 00 00 00') if self.pubKey: ext_bin_null = False msg += Coder.trim('01 01') else: msg += Coder.trim('01 02') ext_bin_null = True msg += self.randomKey msg += Coder.trim('01 02') msg += Coder.num2hexstr(len(self.pubKey) / 2, 2) if ext_bin_null: msg += Coder.trim('00 00') else: msg += self.pubKey #TEA加密的TLV msg += self.packSendLoginTlv(verifyCode) msg += Coder.trim('03') msg = Coder.num2hexstr(len(msg) / 2 + 2 + 1, 2) + msg msg = Coder.trim('02') + msg msg = Coder.num2hexstr(len(msg) / 2 + 4, 4) + msg packet = msgHeader + msg packet = TEA.entea_hexstr(packet, self.defaultKey) return packet
def packSendLoginMessage(self, verifyCode=None): #MessageHead msgHeader = '' msgHeader += Coder.num2hexstr(self.seq+1, 4) msgHeader += self.appId msgHeader += self.appId msgHeader += Coder.trim('01 00 00 00 00 00 00 00 00 00 00 00') msgHeader += Coder.num2hexstr(len(self.extBin)/2+4, 4) + self.extBin msgHeader += Coder.num2hexstr(len(self.loginCmd)/2+4, 4) + self.loginCmd msgHeader += Coder.num2hexstr(len(self.msgCookies)/2+4, 4) + self.msgCookies msgHeader += Coder.num2hexstr(len(self.imei)/2+4, 4) + self.imei msgHeader += Coder.num2hexstr(len(self.ksid)/2+4, 4) + self.ksid msgHeader += Coder.num2hexstr(len(self.ver)/2+2, 2) + self.ver msgHeader = Coder.num2hexstr(len(msgHeader)/2+4, 4) + msgHeader print 'msgHeader len :'+bytes(len(msgHeader)) #Message msg = '' msg += Coder.trim('1F 41') msg += Coder.trim('08 10 00 01') msg += self.uin msg += Coder.trim('03 07 00 00 00 00 02 00 00 00 00 00 00 00 00 01 01') msg += self.randomKey msg += Coder.trim('01 02') msg += Coder.num2hexstr(len(self.pubKey)/2, 2) + self.pubKey print 'packSendLoginTlv start len : ' + bytes(len(msg)) packSendLoginTlv = self.packSendLoginTlv(verifyCode) #TEA加密的TLV msg += packSendLoginTlv print ' packSendLoginTlv end len : ' +bytes(len(msg)) msg += Coder.trim('03') msg = Coder.num2hexstr(len(msg)/2+2+1, 2) + msg msg = Coder.trim('02') + msg msg = Coder.num2hexstr(len(msg)/2+4, 4) + msg packet = msgHeader + msg print 'packSendLoginTlv index :' + bytes(packet.find(packSendLoginTlv)) + '----' + bytes(packet.find(packSendLoginTlv)+len(packSendLoginTlv)) packet = TEA.entea_hexstr(packet, self.defaultKey) print 'packet entea_hexstr content :' +packet return packet
def Make_sendSsoMsg(self, cmd, bin): """ SsoMsg二次组包使用 qqkey 加密 (完整) || **--> Pack_sendSsoMsg_simple -> this || """ serviceCmd = Coder.str2hexstr(cmd) msg = '' msg += Coder.num2hexstr(len(serviceCmd) / 2 + 4, 4) + serviceCmd msg += Coder.num2hexstr(len(config.msgCookies) / 2 + 4, 4) + config.msgCookies data = '' data += Coder.num2hexstr(len(msg) / 2 + 4, 4) + msg data += bin value = TEA.entea_hexstr(data, self.qqkey) return value
def tlv106(uin, server_time, pwdMd5, tgtKey, imei, appId, pwdKey): tlv = '' tlv += Coder.trim('00 03') tlv += Coder.genBytesHexstr(4) tlv += Coder.trim('00 00 00 05 00 00 00 10 00 00 00 00 00 00 00 00') tlv += uin tlv += server_time tlv += Coder.trim('00 00 00 00 01') tlv += pwdMd5 tlv += tgtKey tlv += Coder.trim('00 00 00 00 01') tlv += imei tlv += appId tlv += Coder.trim('00 00 00 01') tlv += Coder.trim('00 00') tlv = TEA.entea_hexstr(tlv, pwdKey) tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 06') + tlv return tlv
def tlv106(uin, server_time, pwdMd5, tgtKey, imei, appId, pwdKey): tlv = '' tlv += Coder.trim('00 03') tlv += Coder.genBytesHexstr(4) tlv += Coder.trim('00 00 00 05 00 00 00 10 00 00 00 00 00 00 00 00') tlv += uin tlv += server_time tlv += Coder.trim('00 00 00 00 01') tlv += pwdMd5 tlv += tgtKey tlv += Coder.trim('00 00 00 00 01') tlv += imei tlv += appId tlv += Coder.trim('00 00 00 01') tlv += Coder.trim('00 00') tlv = TEA.entea_hexstr(tlv, pwdKey) tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 06') + tlv return tlv
def Make_login_sendSsoMsg(self, cmd, bin): #MessageHead cmd = Coder.str2hexstr(cmd) msgHeader = '' msgHeader += Coder.num2hexstr(self.seq, 4) msgHeader += self.appId msgHeader += self.appId msgHeader += Coder.trim('01 00 00 00 00 00 00 00 00 00 00 00') msgHeader += Coder.num2hexstr(len(self.token004c) / 2 + 4, 4) + self.token004c msgHeader += Coder.num2hexstr(len(cmd) / 2 + 4, 4) + cmd msgHeader += Coder.num2hexstr(len(self.msgCookies2) / 2 + 4, 4) + self.msgCookies2 msgHeader += Coder.num2hexstr(len(self.imei) / 2 + 4, 4) + self.imei msgHeader += Coder.num2hexstr(len(self.ksid) / 2 + 4, 4) + self.ksid msgHeader += Coder.num2hexstr(len(self.ver) / 2 + 2, 2) + self.ver Header = Coder.num2hexstr(len(msgHeader) / 2 + 4, 4) + msgHeader body = Header + Coder.num2hexstr(len(bin) / 2 + 4, 4) + bin data = TEA.entea_hexstr(body, self.qqkey) return data
def Pack_EncounterSvc_ReqGetEncounter2(self): msg = '' msg += '10032c3c42' msg += str(self.qq00001 + 1) msg += '560c456e636f756e7465724f626a6613434d445f4745545f454e434f554e54455256327d0001' body = '08000206095265714865616465721d0000130a000312' body += Coder.qqnum2hexstr(self.qqnum) body += '2220029f533c40025c6c0b0611526571476574456e636f756e74657256321d0001' body_1 = '0a0a0a0c1c20ff3c0b361642315f51515f4e65696768626f725f616e64726f696446084e7a564b5f7147455c600289' body_1 += '00100a030000c6850826a74b10e00b0a03000014e6e4bf7c2e10e00b0a030000586d8f6806bd10cb0b0a030000b8ee65d56cda10c40b0a0300003c8c4048eb5010cc0b0a0300003c8c4048fdd010c60b0a0300003c8c4049069010c50b0a0300003c8c40490f6010b30b0a0300003c8c4048f7d010b80b0a0300003c8c404902e010b40b0a0300003c8c4048ed7010b00b0a030000246968a5359c10b50b0a0300003c8c404910e010af0b0a0300003c8c4049033010ab0b0a0300003c8c404907c010a90b0a0300003c8c4049085010af0b' body_1 += '9900010a0101cc100121361f31179240ff0b0b1a02' body_1 += Coder.num2hexstr(int(time.time()), 4) body_1 += '12' body_1 += Coder.num2hexstr(self.lat, 4) body_1 += '22' body_1 += Coder.num2hexstr(self.long, 4) body_1 += '3c43' body_1 += '01c9d64000b778c0' body_1 += '56' city = Coder.str2hexstr('浙江省杭州市') body_1 += Coder.num2hexstr(len(city) / 2) + city body_1 += '6d0000130d000c1c2301c9c38000b785403c4c50ff6c7c0b200130ff5d000001006c7107d080ff9cccd001ecfc0ffc10f11101e0fc12fc13fc14f01501fc16f0180ffd1900000e1800200028003000380040004a00fc1afc1bfc1cf61d' j = '{"dtype":1,"muid":"8DF9E26F89DDC39EEA9F32691174D17C","carrier":2,"conn":1,"posw":216,"posh":150,"lat":' + str( self.lat) + ',"lng":' + str( self.long) + ',"c_os":"android","c_osver":"5.1.1"}' jsondata = Coder.str2hexstr(j) body_1 += Coder.num2hexstr(len(jsondata) / 2) + jsondata body_1 += 'f01e3ffc1ff020030b' body += Coder.num2hexstr(len(body_1) / 2, 2) + body_1 msg += Coder.num2hexstr(len(body) / 2, 2) + body msg += '8c980ca80c' print msg d1 = '0000002c00000020456e636f756e7465725376632e526571476574456e636f756e746572' d1 += Coder.trim('00 00 00 08 D7 1C 77 15') d2 = d1 + Coder.num2hexstr(len(msg) / 2 + 4, 4) + msg data = TEA.entea_hexstr(d2, self.qqkey) return Pack(self, data, 2)
def getmessage(self): k = '00000023000000174d6573736167655376632e50624765744d73670000000854e96b10' pb = k + PB.getmsg() + '01' body = TEA.entea_hexstr(pb, self.qqkey) value = self.pack(body, 2) self.FunSend(Coder.hexstr2str(value))