闲来无事做了个简单的不可描述的签到脚本,挂上vps设置cron每天运行,妈妈再也不用担心我忘记签到了
因为对方网站做的太过简陋,以至于登录以后甚至不会往浏览器里扔Cookie,提交除了一个永远不变的uid以外也没有任何验证,于是这个脚本也非常简陋

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
import json
import requests
import datetime

scheme = "https"
host = "host"
path = "/path/to/submit"

post_data = {
"mainTable": {
"wayStart": "",
"arriveTime": "",
"way2Start": "",
"language": "cn",
"declareTime": datetime.datetime.now().strftime('%Y-%m-%d'),
"personNo": "******",
"personName": "******",
"sex": "******",
"professionName": "******",
"collegeName": "******",
"phoneArea": "+86",
"phone": "******",
"assistantName": "******",
"assistantNo": "******",
"className": "******",
"linkman": "赵明毅",
"linkmanPhoneArea": "+86",
"linkmanPhone": "13800138000",
"personHealth": "1",
"temperature": "36.0",
"personHealth2": "0",
"leaveState": "2",
"schoolC1": "2",
"personC4": "",
"otherC4": "",
"isPass14C1": "0",
"isPass14C2": "0",
"isPass14C3": "0"
},
"uid": "******"
}

post_url = scheme + "://" + host + path
post_headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Content-type": "application/json",
"Host": host,
"Origin": scheme + "://" + host,
"Referer": scheme + "://" + host + "/",
"User-Angent": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36"
}
post_data = json.dumps(post_data)
print(post_data)
print("***************")

try:
r = requests.post(post_url, headers = post_headers, data = post_data, verify=False)
except Exception as e:
print("出错了:" + str(e))
else:
print(r.text)
print("***************")
if r.json()['success'] :
print("签到成功!")
else:
print("签到失败或今天已签到")