-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoursesniper.py
88 lines (72 loc) · 2.81 KB
/
coursesniper.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import requests, time, random
from termcolor import colored, cprint
"""
In this script unllike the other one, we sent requests to the Website
and the user must login into his/her account and then head into insoect and in the Network section
get the token and then feed it to the script as the Authorization key.
At last the user must insert the data for courses such is uts code, its credits, the no. of the group and the
action that must be applied(taking, regrouping, removing the course)
"""
cprint("Hello!", "green")
auth = input(colored("Authorization Key: ", "yellow"))
courses = {
# ADD Course 0
# Move Group 1
# Remove 2
"25746-2": [0,'1'],
"25746-3": [0,'1']
#"25751-1" : [1, '3'],
#"25741-1" : [2, '4'],
#"25733-2" : [0, '3'],
#"25769-1" : [0, '3'],
#"25729-1" : [0, '3']
}
headers = {
"Authorization": auth,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.141 Safari/537.36",
"Sec-Ch-Ua-Platform": "",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://my.edu.sharif.edu/courses/offered",
"Origin": "https://my.edu.sharif.edu",
}
a=input("just hit a key!")
while True:
for course in courses:
if (courses[course][0] == 0):
cprint(
"[+] Sending ADD request for: " + course + " -> " + courses[course][1] + " units",
"blue",
)
requests.post(
"https://my.edu.sharif.edu/api/reg",
headers=headers,
json={"action": "add", "course": course, "units": courses[course][1]},
)
cprint("[+] Sent", "green")
elif (courses[course][0] == 1):
cprint(
"[+] Sending MOVE request for: " + course + " -> " + courses[course][1] + " units",
"cyan",
)
requests.post(
"https://my.edu.sharif.edu/api/reg",
headers=headers,
json={"action": "move", "course": course, "units": courses[course][1]},
)
cprint("[+] Sent", "green")
elif (courses[course][0] == 2):
cprint(
"[+] Sending REMOVE request for: " + course + " -> " + courses[course][1] + " units",
"light_blue",
)
requests.post(
"https://my.edu.sharif.edu/api/reg",
headers=headers,
json={"action": "remove", "course": course, "units": courses[course][1]},
)
cprint("[+] Sent", "green")
cprint("[+] Waiting ...",'yellow')
randAm = random.uniform(0,0.05) + 5
time.sleep(randAm)