-
Notifications
You must be signed in to change notification settings - Fork 0
/
签到.py
57 lines (36 loc) · 1.1 KB
/
签到.py
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
import sys
import time
import socket
def printcn(b): #配置中文输出函数
sys_encoding = sys.getfilesystemencoding()
print(b.decode('utf-8').encode(sys_encoding))
reload(sys)
sys.setdefaultencoding("utf-8")
def hqpz():
message ='GET /huanghuai/libraryAppointmentOrder_getAppoint?cardnum=YKT1534130130 HTTP/1.1\r\ncache: 0\r\nHost: mob.huanghuai.edu.cn\r\n\r\n'
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except:
s.close()
printcn("socket 正在重建")
try:
host = 'mob.huanghuai.edu.cn'
remote_ip= socket.gethostbyname( host )
socket.gethostbyname( host )
except:
s.close()
ip=remote_ip
try:
s.connect((ip,80))
except:
s.close()
try :
s.sendall(message)
except:
s.close()
reply = s.recv(1024)
pz=reply[371:382]
printcn(reply)
printcn(pz)
s.close()
hqpz()