def getUrl(self,url): skey = '' for ck in self.myHttpRequest.cj: if ck.name=='skey': skey = ck.value base_url = url base_url = base_url.replace('GTK', str(Tea.getGTK(skey))) return base_url
def loginCard(self): skey = '' for ck in self.myHttpRequest.cj: if ck.name == 'skey': skey = ck.value postData = {'code': '', 'uin': constant.USERNAME} base_url = constant.CARDLOGINURL base_url = base_url.replace('GTK', str(Tea.getGTK(skey))) page_content = self.myHttpRequest.get_response(base_url, postData) return page_content.read()
def loginQQ(self, e): try: configFile = open('Mfkp_config.ini', 'r') mystr = configFile.readline() if str(constant.USERNAME) in mystr: constant.COLLECTTHEMEID = int( configFile.readline().split('=')[1]) constant.STEALFRIEND = int(configFile.readline().split('=')[1]) constant.QQSHOWSELECT = int( configFile.readline().split('=')[1]) constant.QQSHOWID = int(configFile.readline().split('=')[1]) configFile.close() except Exception: print 'file can not find' verifysession = '' if self.codeInput.IsShown(): code = str(self.codeInput.GetValue()) for ck in self.myHttpRequest.cj: if ck.name == 'verifysession': verifysession = ck.value else: code = str(constant.CODE) verifysession = str(constant.SESSION) constant.PASSWORD = str(self.aidInput.GetValue()) password = Tea.getTEAPass(constant.USERNAME, constant.PASSWORD, code) base_url = constant.LOGINURL base_url = base_url.replace('USERNAME', str(constant.USERNAME)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD', password) base_url = base_url.replace('CODE', code) page_content = self.myHttpRequest.get_response(base_url) result = page_content.read() if str(constant.USERNAME) in result: dlg = wx.MessageDialog(self, u"密码或验证码不正确", caption=u'提示', style=wx.OK, pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy() getCodethread = myThread.GetCodePicThread(self, self.myHttpRequest, constant.USERNAME) getCodethread.start() else: self.Destroy() main.Main(None, u'魔法卡片', self.myHttpRequest, self.database, self.cur_file_dir())
def loginCard(self): skey = '' for ck in self.myHttpRequest.cj: if ck.name=='skey': skey = ck.value postData = { 'code':'', 'uin':constant.USERNAME } base_url = constant.CARDLOGINURL base_url = base_url.replace('GTK', str(Tea.getGTK(skey))) page_content = self.myHttpRequest.get_response(base_url,postData) return page_content.read()
def loginQQ(self,e): try: configFile = open('Mfkp_config.ini','r') mystr = configFile.readline() if str(constant.USERNAME) in mystr: constant.COLLECTTHEMEID = int(configFile.readline().split('=')[1]) constant.STEALFRIEND = int(configFile.readline().split('=')[1]) constant.QQSHOWSELECT = int(configFile.readline().split('=')[1]) constant.QQSHOWID = int(configFile.readline().split('=')[1]) configFile.close() except Exception: print 'file can not find' verifysession = '' if self.codeInput.IsShown(): code = str(self.codeInput.GetValue()) for ck in self.myHttpRequest.cj: if ck.name=='verifysession': verifysession = ck.value else: code = str(constant.CODE) verifysession = str(constant.SESSION) constant.PASSWORD = str(self.aidInput.GetValue()) password = Tea.getTEAPass(constant.USERNAME,constant.PASSWORD,code) base_url = constant.LOGINURL base_url = base_url.replace('USERNAME', str(constant.USERNAME)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD',password) base_url = base_url.replace('CODE',code) page_content = self.myHttpRequest.get_response(base_url) result = page_content.read() if str(constant.USERNAME) in result: dlg = wx.MessageDialog(self,u"密码或验证码不正确",caption=u'提示',style=wx.OK,pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy() getCodethread = myThread.GetCodePicThread(self,self.myHttpRequest,constant.USERNAME) getCodethread.start() else: self.Destroy() main.Main(None,u'魔法卡片',self.myHttpRequest,self.database,self.cur_file_dir())
def loginQQ(self,my_http_request,key,value,verifysession,code): # constant.PASSWORD = str(value) password = Tea.getTEAPass(int(key),str(value),code) base_url = constant.QQLOGINURL base_url = base_url.replace('USERNAME', str(key)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD',password) base_url = base_url.replace('CODE',code) page_content = my_http_request.get_response(base_url).read().decode('utf-8') logging.info(page_content) print page_content if u'暂时' in page_content: return -2,page_content if u'登录成功' not in page_content: return True,page_content else: # print page_content sid = re.findall('sid=(.*?)\'',page_content,re.S) print sid self.accout_sid_dic[key] = sid[0] return False,page_content
def loginQQ(self,e): config = ConfigParser.ConfigParser() try: config.read('Mfkp_config.ini') constant.REFINEDTYPE = int(config.get('userconfig','refinedtype')) constant.COLLECTTHEMEID = int(config.get('userconfig','themeid')) constant.COLLECTTHEMEID2 = int(config.get('userconfig','themeid2')) constant.STEALFRIEND = int(config.get('userconfig','friendid')) constant.QQSHOWSELECT = int(config.get('userconfig','qqshow')) constant.QQSHOWID = int(config.get('userconfig','qqshowid')) constant.QQSHOWSELECT2 = int(config.get('userconfig','qqshow2')) constant.QQSHOWID2 = int(config.get('userconfig','qqshowid2')) try: constant.STEALFRIEND2 = int(config.get('userconfig','friendid2')) except : pass except Exception: print 'file can not find' verifysession = '' if self.codeInput.IsShown(): code = str(self.codeInput.GetValue()) for ck in self.myHttpRequest.cj: if ck.name=='verifysession': verifysession = ck.value else: code = str(constant.CODE) verifysession = str(constant.SESSION) constant.PASSWORD = str(self.aidInput.GetValue()) password = Tea.getTEAPass(constant.USERNAME,constant.PASSWORD,code) base_url = constant.QQLOGINURL base_url = base_url.replace('USERNAME', str(constant.USERNAME)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD',password) base_url = base_url.replace('CODE',code.encode('utf-8')) page_content = self.myHttpRequest.get_response(base_url).read().decode('utf-8') try: print page_content except: pass if u'登录成功' not in page_content: dlg = wx.MessageDialog(self,u"密码或验证码不正确",caption=u'提示',style=wx.OK,pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy() getCodethread = myThread.GetCodePicThread(self,self.myHttpRequest,constant.USERNAME) getCodethread.start() else: isFriend = self.getUserList() if isFriend: sid = re.findall('sid=(.*?)\'',page_content,re.S) print sid constant.SID = sid[0] '''下来是如果是红钻的情况下领取奖励 ''' base_url = self.getUrl(constant.DAILYURL) postData = { 'uin':constant.USERNAME, 'type':1 } page_content = self.myHttpRequest.get_response(base_url,postData) print page_content.read() self.Destroy() main.Main(None,u'熊熊助手-'+str(constant.USERNAME),self.myHttpRequest,self.loginCard(),self.database) else: dlg = wx.MessageDialog(self,u"对不起你没有权限登陆",caption=u'提示',style=wx.OK,pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy()