Created
July 20, 2018 08:25
-
-
Save ihciah/305ae130c352d81480de27549d441ec7 to your computer and use it in GitHub Desktop.
Fudan Keep Online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import time | |
def login(): | |
username = "" | |
password = "" | |
url = "http://10.108.255.249/include/auth_action.php" | |
data = {"username": username, | |
"password": password, | |
"action": "login", | |
"ajax": 1, | |
"save_me": 1, | |
"ac_id": 1 | |
} | |
requests.post(url, data, timeout=2) | |
def check(): | |
test_content = requests.get("http://t.cn", timeout=2) | |
return "wlrz.fudan.edu.cn" in test_content.text | |
def force_func(f): | |
while True: | |
try: | |
return f() | |
except: | |
pass | |
def check_then_login(): | |
is_need = force_func(check) | |
if is_need: | |
login() | |
def keep_me_online(): | |
while True: | |
force_func(check_then_login) | |
time.sleep(5) | |
if __name__ == "__main__": | |
keep_me_online() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment