-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Byteintosh/dev
Refactor
- Loading branch information
Showing
3 changed files
with
85 additions
and
79 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,37 @@ | ||
name: Auto grant Adobe | ||
|
||
name: Automatic get Adobe from Software KMUTNB | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "releases/**" | ||
branches: | ||
- main | ||
pull_request: | ||
type: [opened] | ||
branches: [main] | ||
schedule: | ||
- cron: "0 22 * * 0" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
pip install python-dotenv | ||
- name: 'Create env file' | ||
python -m pip install --upgrade pip | ||
pip install requests python-dotenv | ||
- name: Create env file | ||
run: | | ||
touch .env | ||
echo KMUTNB_USERNAME=${{ secrets.KMUTNB_USERNAME }} >> .env | ||
echo KMUTNB_PASSWORD=${{ secrets.KMUTNB_PASSWORD }} >> .env | ||
echo "KMUTNB_USERNAME=${{ secrets.KMUTNB_USERNAME }}" >> .env | ||
echo "KMUTNB_PASSWORD=${{ secrets.KMUTNB_PASSWORD }}" >> .env | ||
cat .env | ||
- name: Running Payload | ||
run: | | ||
python payload.py | ||
run: python payload.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
# Adobe KMUTNB | ||
Automated grant Adobe acess for KMUTNB Student | ||
## How it work? | ||
Urmmm, its just simple request lol. | ||
Automated grant Adobe access for KMUTNB students | ||
|
||
## How to use? | ||
1. Fork This project | ||
2. Create Secret in Repository secrets | ||
|
||
Repository secrets: | ||
|
||
`KMUTNB_USERNAME=s6601234567890` | ||
|
||
`KMUTNB_PASSWORD=your_password_here` | ||
## How it works? | ||
It's a simple request process. | ||
|
||
## How to use? | ||
1. Fork this project. | ||
2. Create secrets in the repository secrets: | ||
- `KMUTNB_USERNAME=your_icit_username_here` | ||
- `KMUTNB_PASSWORD=your_icit_password_here` | ||
|
||
2.1 using "Payload_nodotenv" (if payload.py not working.) | ||
so, this file dotenv file code are removed | ||
you can edit username , password into payload file and save // Warning: do not publish your password on public. | ||
4. Add Github Action workflow into repo | ||
5. Done! | ||
2.1 If `payload.py` is not working, Remove the dotenv file code and edit the username and password directly in the payload file. Save the file, but be cautious not to publish your password publicly. | ||
|
||
3. Add the GitHub Action workflow to the repository. | ||
4. Done! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,78 @@ | ||
import requests as rq | ||
from dotenv import load_dotenv, dotenv_values | ||
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" | ||
|
||
# EXAMPLE .ENV FILE | ||
|
||
# .env | ||
# KMUTNB_USERNAME=s66xxxxxxxxxxx | ||
# KMUTNB_PASSWORD=wtfisthisuniversity | ||
|
||
# DIRECTORY OF FILE | ||
# -- adobe-kmutnb | ||
# | | ||
# - > .env | ||
# - > payload.py | ||
|
||
# ENV FILE STUFF | ||
|
||
# LOAD ENVIRONMENT VARIABLES | ||
load_dotenv() | ||
|
||
# GET USERNAME AND PASSWORD FROM ENVIRONMENT VARIABLES | ||
username = os.getenv("KMUTNB_USERNAME") | ||
password = os.getenv("KMUTNB_PASSWORD") | ||
|
||
# HEADERS PAYLOAD // IDK WHY ITS WORKING =_= | ||
# 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", | ||
"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 // GRAB FROM .ENV FILE | ||
payload_data = { "myusername": username, "mypassword": password, "Submit": ''} | ||
"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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", | ||
"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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", | ||
"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"} | ||
"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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", | ||
"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-02-19", "status_number": "0", "Submit_get": ''} | ||
adobe_data = { | ||
"userId": '', | ||
"date_expire": "2024-02-19", | ||
"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) | ||
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) |