● Features ● Installation ● Usage ● License
Warning
This script may not work as expected. Use at your own risk.
preview-war.mp4
preview-track.mp4
- Automatic authentication to university portal
- Handle CAPTCHA challenges via interactive Discord bot
- Send CAPTCHA notifications via Discord webhook when Discord bot is not set
Modules:
- war: Bot to search and enroll for courses by course and professor names.
- track: Track changes in course offerings, including professor, schedule, location, and more.
- autofill: Automates IRS filling after manual authentication.
- Install uv
- Download/clone this repository
In root of the repository,
- Run
uv sync. (This will install all the required project dependencies and set up the project environment) - Run
uv run playwright install-deps && uv run playwright install. (This will install the necessary dependencies for Playwright, which is used for web scraping and automation) - Copy
.env-examplefile to.envand fill in the required environment variables. Each variable is documented in the.env-examplefile.
Tip
Press Ctrl + C to stop the program while it's running.
Create a courses.yaml file to configure your target courses. For example:
# You can use course, prof, time, and code to select courses.
# 1. Select by Course only (picks the first available class for this course)
- course: Database
# 2. Select by Course and Professor
- course: Analisis Mult
prof: Titin
# 3. Select by Course and Time
- course: Agama Buddha
time: Jumat
# 4. Select by Course, Professor, AND Time
- course: Analisis 1
prof: Putri
time: Senin, 08.00-09.40
# 5. Select by unique Class Code (skips course/prof/time matching)
- code: "782396"
# 6. You can add names for your own reference
- name: "My Favorite Elective"
code: "785627"Tip
Read Testing section for testing your courses.yaml configuration
You can run using uv run warlock war.
The War bot supports flexible matching criteria (case-insensitive partial matches):
- Course & Professor: Matches course name and professor name.
- Class Code: Matches the unique class code (radio button value).
- Time: Matches course name and schedule time.
- Legacy JSON:
{"Course Name": "Prof Name"}format is still supported for backward compatibility.
In root of the repository, run uv run warlock track.
This module helps you fill the IRS form quickly after you log in manually. It is useful when you want to handle the login process yourself but want the bot to select courses for you.
- Configure
courses.jsonas described in the War bot section. - Run
uv run warlock autofill. - A browser window will open. Log in and select your role manually.
- Once you are in, the bot will automatically navigate to the IRS page, fill in the courses, and scroll to the bottom.
- You can then review and submit manually.
You can configure a Discord bot to handle CAPTCHA challenges remotely.
- Create a Discord Bot and get the token.
- Invite the bot to your server.
- Get the Channel ID where you want the bot to post.
- Set BOTH
DISCORD_TOKENandDISCORD_CHANNEL_IDin your.env.
When a CAPTCHA appears, the bot will post the image to the channel. Reply to the bot's message with the solution code to solve it.
NOTE: If you do not configure the Discord Bot, you must set HEADLESS=false in your .env. The browser window will open, and you will need to solve the CAPTCHA manually in the browser when prompted.
You can verify your courses.yaml configuration against a saved schedule HTML file without connecting to the actual server. This allows you to check if your target courses match the available classes correctly.
We use pytest for manual and integration testing.
Arguments:
--run-manual: Required to run manual tests (WarBot, AutoFill).--run-webhook: Required to run Discord webhook integration tests (Tracker).--schedule-html=<path>: Path to the saved "Jadwal Kelas Mata Kuliah" HTML file.
Note
Get schedule html file by navigating to https://academic.ui.ac.id/main/Schedule/Index and saving the page with Ctrl + S
Examples:
Manual Bot Testing:
uv run pytest tests/manual/test_warbot_manual.py --run-manual --schedule-html=<path>Webhook Integration Testing:
uv run pytest tests/webhook/test_tracker_webhook.py --run-webhookWarning
--schedule-html will cause an error if you don't include the equal between the arg name and value
This will run the bot in test mode, generate a mock IRS page populated with courses from the provided HTML, and attempt to select the courses defined in your courses.yaml. Check the logs to see which courses were selected.
This project is licensed under the MIT License. See the LICENSE file for details.