forked from kunamori/auto-adobe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
payload.py
78 lines (70 loc) · 3.1 KB
/
payload.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
import requests as rq
from dotenv import load_dotenv
import os
# LOGIN URL VARIABLE
login_url = "https://software.kmutnb.ac.th/login/"
loggedin_url = "https://software.kmutnb.ac.th/download/"
adobe_url = "https://software.kmutnb.ac.th/adobe-reserve/processa.php"
# LOAD ENVIRONMENT VARIABLES
load_dotenv()
# GET USERNAME AND PASSWORD FROM ENVIRONMENT VARIABLES
username = os.getenv("KMUTNB_USERNAME")
password = os.getenv("KMUTNB_PASSWORD")
# HEADERS PAYLOAD
payload_headers = {
"Cache-Control": "max-age=0",
"Sec-Ch-Ua": "\"Not A(Brand\";v=\"99\", \"Google Chrome\";v=\"121\", \"Chromium\";v=\"121\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Windows\"",
"Upgrade-Insecure-Requests": "1",
"Origin": "https://software.kmutnb.ac.th",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-User": "?1",
"Sec-Fetch-Dest": "document",
"Referer": "https://software.kmutnb.ac.th/login/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "th-TH,th;q=0.9",
"Connection": "close"
}
# DATA PAYLOAD
payload_data = {
"myusername": username,
"mypassword": password,
"Submit": ''
}
# HEADER AND DATA (Adobe Process)
adobe_url = "https://software.kmutnb.ac.th:443/adobe-reserve/add2.php"
adobe_headers = {
"Cache-Control": "max-age=0",
"Sec-Ch-Ua": "\"Not A(Brand\";v=\"99\", \"Google Chrome\";v=\"121\", \"Chromium\";v=\"121\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Windows\"",
"Upgrade-Insecure-Requests": "1",
"Origin": "https://software.kmutnb.ac.th",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-User": "?1",
"Sec-Fetch-Dest": "document",
"Referer": "https://software.kmutnb.ac.th/adobe-reserve/processa.php",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "th-TH,th;q=0.9",
"Connection": "close"
}
adobe_data = {
"userId": '',
"date_expire": "2024-09-01",
"status_number": "0",
"Submit_get": ''
}
# USING SESSION FOR HOLD SESSION FOR GRANT ADOBE ACCESS
with rq.session() as rqss:
rqss.post(login_url, headers=payload_headers, data=payload_data, verify=False)
req3 = rqss.post(adobe_url, headers=adobe_headers, data=adobe_data, verify=False)
print(req3.text)