Skip to content
/ warlock Public

SIAK-NG (https://academic.ui.ac.id) automation scripts: War Bot for course registration, schedule update tracker, Discord alerts, CAPTCHA handling

License

Notifications You must be signed in to change notification settings

FAZuH/warlock

Repository files navigation

Features   ● Installation   ● Usage   ● License

Warning

This script may not work as expected. Use at your own risk.

preview-war.mp4
preview-track.mp4

Features

  • 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.

Installation

  1. Install uv
  2. Download/clone this repository

In root of the repository,

  1. Run uv sync. (This will install all the required project dependencies and set up the project environment)
  2. 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)
  3. Copy .env-example file to .env and fill in the required environment variables. Each variable is documented in the .env-example file.

Usage

Tip

Press Ctrl + C to stop the program while it's running.

War bot

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.

Schedule update tracker

In root of the repository, run uv run warlock track.

AutoFill

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.

  1. Configure courses.json as described in the War bot section.
  2. Run uv run warlock autofill.
  3. A browser window will open. Log in and select your role manually.
  4. Once you are in, the bot will automatically navigate to the IRS page, fill in the courses, and scroll to the bottom.
  5. You can then review and submit manually.

Discord Bot for CAPTCHA

You can configure a Discord bot to handle CAPTCHA challenges remotely.

  1. Create a Discord Bot and get the token.
  2. Invite the bot to your server.
  3. Get the Channel ID where you want the bot to post.
  4. Set BOTH DISCORD_TOKEN and DISCORD_CHANNEL_ID in 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.

Testing

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-webhook

Warning

--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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

SIAK-NG (https://academic.ui.ac.id) automation scripts: War Bot for course registration, schedule update tracker, Discord alerts, CAPTCHA handling

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published