def tlv107(): tlv = '' tlv += Coder.trim('00 00') tlv += Coder.trim('00 00 00 01') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 07') + tlv return tlv
def tlv8(): tlv = '' tlv += Coder.trim('00 00') tlv += Coder.trim('00 00 08 04') #request_global._local_id tlv += Coder.trim('00 00') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('00 08') + tlv return tlv
def tlv202(wifi_name): tlv = '' tlv += Coder.trim('00 10') tlv += Coder.trim('F5 AC 6C 03 0C 31 AE 5C 26 2E BE 49 86 23 65 1E') tlv += Coder.num2hexstr(len(wifi_name)/2, 2) + wifi_name tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('02 02') + tlv return tlv
def tlv177(): tlv = '' tlv += Coder.trim('01') tlv += Coder.trim('55 A3 23 2E') tlv += Coder.trim('00 07') tlv += Coder.trim('35 2E 34 2E 30 2E 37') #5.4.0.7 tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 77') + tlv return tlv
def tlv141(sim_operator_name, network_type, apn): tlv = '' tlv += Coder.trim('00 01') tlv += Coder.num2hexstr(len(sim_operator_name)/2, 2) + sim_operator_name tlv += Coder.num2hexstr(len(network_type)/2, 2) + network_type tlv += Coder.num2hexstr(len(apn)/2, 2) + apn tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 41') + tlv return tlv
def tlv116(): tlv = '' tlv += Coder.trim('00') tlv += Coder.trim('00 01 FF 7C') tlv += Coder.trim('00 01 04 00') tlv += Coder.trim('00') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 16') + tlv return tlv
def __init__(self, qqnum, qqpwd): self.socket = RawSocket('113.108.90.53', 8080) if not self.socket.connect(): raise Exception('socket connect error!') #QQ self.qqnum = qqnum self.qqpwd = qqpwd self.vcode = '' self.qqHexstr = Coder.str2hexstr(qqnum) self.pwdMd5 = MD5.md5_hex(qqpwd) self.uin = Coder.qqnum2hexstr(qqnum) self.HEART_INTERVAL = 8*60 #心跳时间间隔 如果在手机QQ上注销/退出帐号后,一般10分钟左右您的QQ号就不会显示在线了 self.server_time = Coder.num2hexstr(int(time.time()), 4) self.alive = False self.verify = False #Android self.seq = 1000 self.appId = Coder.num2hexstr(537042772, 4) self.extBin = Coder.trim('') self.msgCookies = Coder.trim('F9 83 8D 80') self.imei = Coder.str2hexstr('864116195797922') self.ksid = Coder.trim('') self.extBin = Coder.trim('') self.ver = Coder.str2hexstr('|460006202217491|A5.8.0.157158') self.os_type = Coder.str2hexstr('android') self.os_version = Coder.str2hexstr('4.2.2') self.network_type = Coder.str2hexstr('') self.sim_operator_name = Coder.str2hexstr('CMCC') self.apn = Coder.str2hexstr('wifi') self.device = Coder.str2hexstr('Lenovo A820t') self.device_product = Coder.str2hexstr('Lenovo') self.package_name = Coder.str2hexstr('com.tencent.mobileqq') self.wifi_name = Coder.str2hexstr('OOOOOOOOO') #cmd self.loginCmd = Coder.str2hexstr('wtlogin.login') #Keys self.defaultKey = '00'*16 self.randomKey = Coder.genBytesHexstr(16) self.keyId = random.randint(0, len(Keys.pubKeys)-1) self.pubKey = Keys.pubKeys[self.keyId] self.shareKey = Keys.shareKeys[self.keyId] self.pwdKey = Coder.hash_qqpwd_hexstr(qqnum, qqpwd) self.tgtKey = Coder.genBytesHexstr(16) self.sessionKey = '' #debug print 'uin: ', self.uin print 'pwdMd5: ', self.pwdMd5 print 'randomKey: ', self.randomKey print 'pubKey: ', self.pubKey print 'shareKey: ', self.shareKey print 'pwdKey: ', self.pwdKey print 'tgtKey: ', self.tgtKey
def tlv124(os_type, os_version, network_type, sim_operator_name, apn): tlv = '' tlv += Coder.num2hexstr(len(os_type)/2, 2) + os_type tlv += Coder.num2hexstr(len(os_version)/2, 2) + os_version tlv += Coder.num2hexstr(len(network_type)/2, 2) + network_type tlv += Coder.num2hexstr(len(sim_operator_name)/2, 2) + sim_operator_name tlv += Coder.trim('00 00') tlv += Coder.num2hexstr(len(apn)/2, 2) + apn tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 24') + tlv return tlv
def tlv1(uin, server_time): tlv = '' tlv += Coder.trim('00 01') tlv += Coder.genBytesHexstr(4) tlv += uin tlv += server_time tlv += Coder.trim('00 00 00 00') tlv += Coder.trim('00 00') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('00 01') + tlv return tlv
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 login(self, verifyCode=None): '''登录''' #发送登录请求 packet = '' #包头 packet += Coder.trim('00 00 00 08 02 00 00 00 04 00') packet += Coder.num2hexstr(len(self.qqHexstr)/2+4, 4) packet += self.qqHexstr #TEA加密的包体 packet += self.packSendLoginMessage(verifyCode) #总包长 packet = Coder.num2hexstr(len(packet)/2+4, 4) + packet #发送请求 self.socket.sendall(Coder.hexstr2str(packet)) #接收请求 ret = self.socket.recv() pack = HexPacket(Coder.str2hexstr(ret)) #返回包头 pack.shr(4) pack.shr(8) pack.shr(2 + len(self.qqHexstr)/2) #返回包体 self.unpackRecvLoginMessage(pack.remain()) if self.alive: #登录成功 threading.Thread(target=self.startHeart).start() #心跳 return True elif self.verify: #需要验证码 pass else: return False
def tlv2(verifyCode, verifyToken1): tlv = '' tlv += Coder.num2hexstr(len(verifyCode)/2, 4) + verifyCode tlv += Coder.num2hexstr(len(verifyToken1)/2, 2) + verifyToken1 tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('00 02') + tlv 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 tlv100(): tlv = '' tlv += Coder.trim('00 01') tlv += Coder.trim('00 00 00 05') tlv += Coder.trim('00 00 00 10') tlv += Coder.trim('20 02 9F 54') tlv += Coder.trim('00 00 00 00') tlv += Coder.trim('02 1E 10 E0') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 00') + tlv return tlv
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 tlv16b(): tlv = '' tlv += Coder.trim('00 02') tlv += Coder.trim('00 0B') tlv += Coder.trim('67 61 6D 65 2E 71 71 2E 63 6F 6D') #game.qq.com tlv += Coder.trim('00 0B') tlv += Coder.trim('67 61 6D 65 2E 71 71 2E 63 6F 6D') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 6B') + tlv return tlv
def tlv147(): tlv = '' tlv += Coder.trim('00 00 00 10') tlv += Coder.trim('00 05') tlv += Coder.trim('35 2E 38 2E 30') #request_global._apk_v = 5.8.0 tlv += Coder.trim('00 10') tlv += Coder.trim('A6 B7 45 BF 24 A2 C2 77 52 77 16 F6 F3 6E B6 8D') #request_global._apk_sig tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 47') + tlv return tlv
def tlv18(uin): tlv = '' tlv += Coder.trim('00 01') tlv += Coder.trim('00 00 06 00') tlv += Coder.trim('00 00 00 10') tlv += Coder.trim('00 00 00 00') tlv += uin tlv += Coder.trim('00 00 00 00') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('00 18') + tlv return tlv
def tlv128(device, imei, device_product): tlv = '' tlv += Coder.trim('00 00') tlv += Coder.trim('01') tlv += Coder.trim('01') tlv += Coder.trim('00') tlv += Coder.trim('11 00 00 00') tlv += Coder.num2hexstr(len(device)/2, 2) + device tlv += Coder.num2hexstr(len(imei)/2, 2) + imei tlv += Coder.num2hexstr(len(device_product)/2, 2) + device_product tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 28') + 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 tlv142(package_name): tlv = '' tlv += Coder.num2hexstr(len(package_name) / 2, 4) + package_name tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 42') + tlv return tlv
def tlv16e(device): tlv = '' tlv += Coder.num2hexstr(len(device) / 2, 2) + device tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 6E') + tlv return tlv
def tlv109(imei): tlv = '' tlv += Coder.num2hexstr(len(imei) / 2, 2) + imei tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 09') + tlv return tlv
def tlv194(): tlv = '' tlv += Coder.trim('65 68 D4 A4 FA CA 6E 78 B3 6B 07 40 C2 71 A8 6E') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 94') + tlv return tlv
def tlv104(verifyToken2): tlv = '' tlv += verifyToken2 tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 04') + tlv return tlv
def tlv191(): tlv = '' tlv += Coder.trim('01') tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 91') + tlv return tlv
def tlv187(): tlv = '' tlv += Coder.trim('F9 03 BA FF 80 D5 BA AC DC EA 9C 16 49 6F 53 83') tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 87') + tlv return tlv
def tlv191(): tlv = '' tlv += Coder.trim('01') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 91') + tlv return tlv
def tlv104(verifyToken2): tlv = '' tlv += verifyToken2 tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 04') + tlv return tlv
def tlv145(imei): tlv = '' tlv += imei tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 45') + tlv return tlv
def tlv188(): tlv = '' tlv += Coder.trim('3F D1 F5 BA 24 67 56 F3 97 87 49 AE 1D 67 76 EE') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 88') + tlv return tlv
def tlv154(seq): tlv = '' tlv += Coder.num2hexstr(seq, 4) tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 54') + tlv return tlv
def tlv16e(device): tlv = '' tlv += Coder.num2hexstr(len(device)/2, 2) + device tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 6E') + tlv return tlv
def tlv188(): tlv = '' tlv += Coder.trim('3F D1 F5 BA 24 67 56 F3 97 87 49 AE 1D 67 76 EE') tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 88') + tlv return tlv
def tlv187(): tlv = '' tlv += Coder.trim('F9 03 BA FF 80 D5 BA AC DC EA 9C 16 49 6F 53 83') tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 87') + tlv return tlv
def tlv194(): tlv = '' tlv += Coder.trim('65 68 D4 A4 FA CA 6E 78 B3 6B 07 40 C2 71 A8 6E') tlv = Coder.num2hexstr(len(tlv) / 2, 2) + tlv tlv = Coder.trim('01 94') + tlv return tlv
def Pack_OidbSvc_0x7a2_0(self): bin = Coder.trim('08 A2 0F 10 00 18 00 22 02 08 00') data = self.Make_login_sendSsoMsg('OidbSvc.0x7a2_0', bin) pack = self.pack(data, 1) return pack
def decodeTlv(self, cmd, data): if cmd == Coder.trim('01 6A'): pass elif cmd == Coder.trim('01 06'): pass elif cmd == Coder.trim('01 0C'): pass elif cmd == Coder.trim('01 0A'): self.token004c = data elif cmd == Coder.trim('01 0D'): pass elif cmd == Coder.trim('01 14'): pack = HexPacket(data) pack.shr(6) self.token0058 = pack.shr(Coder.hexstr2num(pack.shr(2))) elif cmd == Coder.trim('01 0E'): self.mst1Key = data elif cmd == Coder.trim('01 03'): self.stweb = data elif cmd == Coder.trim('01 1F'): pass elif cmd == Coder.trim('01 38'): pass elif cmd == Coder.trim('01 1A'): pack = HexPacket(data) pack.shr(2 + 1 + 1) self.nickname = Coder.hexstr2str(pack.shr(Coder.hexstr2num(pack.shr(1)))) elif cmd == Coder.trim('01 20'): self.skey = data elif cmd == Coder.trim('01 36'): self.vkey = data elif cmd == Coder.trim('01 1A'): pass elif cmd == Coder.trim('01 20'): pass elif cmd == Coder.trim('01 36'): pass elif cmd == Coder.trim('03 05'): self.sessionKey = data elif cmd == Coder.trim('01 43'): self.token002c = data elif cmd == Coder.trim('01 64'): self.sid = data elif cmd == Coder.trim('01 18'): pass elif cmd == Coder.trim('01 63'): pass elif cmd == Coder.trim('01 30'): pack = HexPacket(data) pack.shr(2) self.server_time = pack.shr(4) self.ip = Coder.hexstr2ip(pack.shr(4)) elif cmd == Coder.trim('01 05'): pack = HexPacket(data) self.verifyToken1 = pack.shr(Coder.hexstr2num(pack.shr(2))) self.verifyPicHexstr = pack.shr(Coder.hexstr2num(pack.shr(2))) elif cmd == Coder.trim('01 04'): self.verifyToken2 = data elif cmd == Coder.trim('01 65'): pack = HexPacket(data) pack.shr(4) title = Coder.hexstr2str(pack.shr(Coder.hexstr2num(pack.shr(1)))) msg = Coder.hexstr2str(pack.shr(Coder.hexstr2num(pack.shr(4)))) self.verifyReason = title + ": " + msg elif cmd == Coder.trim('01 08'): self.ksid = data elif cmd == Coder.trim('01 6D'): self.superKey = data elif cmd == Coder.trim('01 6C'): self.psKey = data else: print 'unknown tlv: ' print cmd, ': ', data
def tlv142(package_name): tlv = '' tlv += Coder.num2hexstr(len(package_name)/2, 4) + package_name tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 42') + tlv return tlv
def decodeTlv(self, cmd, data): if cmd == Coder.trim('01 6A'): pass elif cmd == Coder.trim('01 06'): pass elif cmd == Coder.trim('01 0C'): pass elif cmd == Coder.trim('01 0A'): self.token004c = data print self.token004c elif cmd == Coder.trim('01 0D'): pass elif cmd == Coder.trim('01 14'): pack = HexPacket(data) pack.shr(6) self.token0058 = pack.shr(Coder.hexstr2num(pack.shr(2))) print self.token0058 elif cmd == Coder.trim('01 0E'): self.mst1Key = data elif cmd == Coder.trim('01 03'): self.stweb = data elif cmd == Coder.trim('01 1F'): pass elif cmd == Coder.trim('01 38'): pass elif cmd == Coder.trim('01 1A'): pack = HexPacket(data) pack.shr(2 + 1 + 1) self.nickname = Coder.hexstr2str( pack.shr(Coder.hexstr2num(pack.shr(1)))) elif cmd == Coder.trim('01 20'): self.skey = data print self.skey elif cmd == Coder.trim('01 36'): self.vkey = data print self.vkey elif cmd == Coder.trim('01 1A'): pass elif cmd == Coder.trim('01 20'): pass elif cmd == Coder.trim('01 36'): pass elif cmd == Coder.trim('03 05'): self.sessionKey = data self.qqkey = self.sessionKey elif cmd == Coder.trim('01 43'): self.token002c = data print self.token002c elif cmd == Coder.trim('01 64'): self.sid = data elif cmd == Coder.trim('01 18'): pass elif cmd == Coder.trim('01 63'): pass elif cmd == Coder.trim('01 30'): pack = HexPacket(data) pack.shr(2) self.server_time = pack.shr(4) self.ip = Coder.hexstr2ip(pack.shr(4)) elif cmd == Coder.trim('01 05'): pack = HexPacket(data) self.verifyToken1 = pack.shr(Coder.hexstr2num(pack.shr(2))) self.verifyPicHexstr = pack.shr(Coder.hexstr2num(pack.shr(2))) elif cmd == Coder.trim('01 04'): self.verifyToken2 = data elif cmd == Coder.trim('01 65'): pack = HexPacket(data) pack.shr(4) title = Coder.hexstr2str(pack.shr(Coder.hexstr2num(pack.shr(1)))) msg = Coder.hexstr2str(pack.shr(Coder.hexstr2num(pack.shr(4)))) self.verifyReason = title + ": " + msg elif cmd == Coder.trim('01 08'): self.ksid = data elif cmd == Coder.trim('01 6D'): self.superKey = data elif cmd == Coder.trim('01 6C'): self.psKey = data else: print 'unknown tlv: ' print cmd, ': ', data
def tlv145(imei): tlv = '' tlv += imei tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 45') + tlv return tlv
def __init__(self, qqnum, qqpwd, window): self.window = window # self.ipserver = socket.gethostbyname('msfwifi.3g.qq.com') self.ipserver = '14.215.138.105' self.socket = RawSocket(self.ipserver, 8080) if not self.socket.connect(): raise Exception('socket connect error!') #QQ self.Addvalidation = '你好!' #好友添加验证 self.qqnum = qqnum self.qqpwd = qqpwd self.vcode = '' self.qqHexstr = Coder.str2hexstr(qqnum) self.pwdMd5 = MD5.md5_hex(qqpwd) self.uin = Coder.qqnum2hexstr(qqnum) self.HEART_INTERVAL = 3 * 60 #心跳时间间隔 如果在手机QQ上注销/退出帐号后,一般10分钟左右您的QQ号就不会显示在线了 self.server_time = Coder.num2hexstr(int(time.time()), 4) self.alive = False self.verify = False self.addfriendlist = [] self.friendMsgIDList = [] self.GroupMsgIDList = [] #Android self.seq = 10000 self.appId = Coder.num2hexstr(537042771, 4) self.extBin = Coder.trim('') self.msgCookies = Coder.trim('F9 83 8D 80') self.msgCookies2 = Coder.trim('B6 CC 78 FC') self.imei = Coder.str2hexstr('866413457644252') self.ksid = Coder.trim( '93 AC 68 93 96 D5 7E 5F 94 96 B8 15 36 AA FE 91') self.extBin = Coder.trim('') self.ver = Coder.str2hexstr('5.8.0.157158') self.os_type = Coder.str2hexstr('android') self.os_version = Coder.str2hexstr('4.4.4') self.network_type = Coder.str2hexstr('') self.sim_operator_name = Coder.str2hexstr('CMCC') self.apn = Coder.str2hexstr('wifi') self.device = Coder.str2hexstr('Lenovo A820t') self.device_product = Coder.str2hexstr('Lenovo') self.package_name = Coder.str2hexstr('com.tencent.mobileqq') self.wifi_name = Coder.str2hexstr('OOOOOOOOO') #cmd self.loginCmd = Coder.str2hexstr('wtlogin.login') #Keys self.defaultKey = '00' * 16 self.randomKey = Coder.genBytesHexstr(16) self.keyId = random.randint(0, len(Keys.pubKeys) - 1) self.pubKey = Keys.pubKeys[self.keyId] self.shareKey = Keys.shareKeys[self.keyId] self.pwdKey = Coder.hash_qqpwd_hexstr(qqnum, qqpwd) self.tgtKey = Coder.genBytesHexstr(16) self.sessionKey = '' self.qqkey = '' #debug print 'uin: ', self.uin print 'pwdMd5: ', self.pwdMd5 print 'randomKey: ', self.randomKey print 'pubKey: ', self.pubKey print 'shareKey: ', self.shareKey print 'pwdKey: ', self.pwdKey print 'tgtKey: ', self.tgtKey
def tlv154(seq): tlv = '' tlv += Coder.num2hexstr(seq, 4) tlv = Coder.num2hexstr(len(tlv)/2, 2) + tlv tlv = Coder.trim('01 54') + tlv return tlv