Пример #1
0
def checkuserpass():
    global username,password
    try:
        log = requests.get('http://172.16.254.2/status')
        html = html2text.html2text(log.text)
        if username in html:
            return 1
        else:
            return 0
    except:
            print('Cant Connect to Login Server!')
            wifi.checkwifi()
            time.sleep(2)
Пример #2
0
def info():
    global username,password,usage,traffic
    infodata = {'normal_username': username, 'normal_password': password}

    try:
        inforeq = requests.post('http://172.16.16.1/IBSng/user/', data=infodata)
        html = html2text.html2text(inforeq.text)
        for line in html.split("\n"):
            if "This" in line:
                usage = line.split("|")
                print(usage[1],usage[2])
     #       if "Monthly Traffic Limit" in line:
     #           traffic = line.split('|')
     #           print (traffic[1],traffic[2])
    except:
        print('Cant Connect to Login Server!')
        wifi.checkwifi()
Пример #3
0
def login():
    html = 'Cant Connect to Login Server!'
    username,password=getup()
    while (username == 0):
        username,password=getup()

    data = {'username': username, 'password': password}
    while (html == 'Cant Connect to Login Server!'):
        try:
            r = requests.post('http://172.16.254.2/login', data=data)
            import html2text
            html = html2text.html2text(r.text)
        except:
            print('Cant Connect to Login Server!')
            html = 'Cant Connect to Login Server!'
            wifi.checkwifi()
            time.sleep(2)
    return html
Пример #4
0
def confirm():
    while 1 == 1:
        try:
            log = requests.get('http://172.16.254.2/login')
            html = html2text.html2text(log.text)
            check = checkuserpass()
            if check == 1:
                while "If nothing happens," in html:
                    log = requests.get('http://172.16.254.2/login')
                    html = html2text.html2text(log.text)
                    info()
                    try:
                        time.sleep(60)
                    except:
                        print('Loging Out')
                        try:
                            logout = requests.get('http://172.16.254.2/logout')
                        except:
                            print('Cant Connect to Login Server!')
                            wifi.checkwifi()
                        print('Chang Account...')
                        print('3')
                        time.sleep(1)
                        print('2')
                        time.sleep(1)
                        print('1')
                        time.sleep(0.2)
                        os.system('cls')
                        test()
                else:
                    test()
            else:
                print(
                    'Username and Password is not match!\nTry to log out and login with new account!'
                )
                time.sleep(2)
                try:
                    logout = requests.get('http://172.16.254.2/logout')
                    test()
                except:
                    print('Cant Connect to Login Server!')
                    wifi.checkwifi()
        except:
            print('Cant Connect to Login Server!')
            wifi.checkwifi()
            time.sleep(2)