Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
/ cdc-helper Public archive

A program for users of ComfortDelgro Driving Centre (CDC, SG) to monitor and reserve earlier sessions of lessons.

License

Notifications You must be signed in to change notification settings

mfjkri/cdc-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDC-HELPER

 


⚠️ THIS PROJECT IS NO LONGER BEING MAINTAINED. ⚠️

I am retiring this project and archiving it.

The major reason for it is that I have gotten my license and as such no longer have access to the CDC booking platform. I am also no longer interested/motivated to, as this project was only to aid me in getting my license earlier, so please do not contact me with hopes that I will update it.

Feel free to clone this project for your own use.


 

Inspired by cdc-camper by SilverJan.

Features:

  • Fetch available dates for BTT, RTT, FTT, Practical Lesson, PT and more
  • Compare with booked dates for each
  • Notify user (via Telegram & E-mail) if earlier date is found
  • Attempt and reserve the slot if possible

Prerequisites

Python 3

If you do not already have Python3 install it from the official website [here](https://www.python.org/downloads).

Setting Up

1) TwoCaptcha

This project uses a third party API that is unfortunately a paid service.

As of writing this, the rates of using this API are relatively cheap (SGD$5 can last you for about a month of the program runtime).

To continue using this project, head over to 2captcha.com

  • Create an account.
  • Top up your account with sufficient credits.
  • Copy your API Token and paste it into config.yaml.

If you do not wish to use this service and have some python knowledge, you can attempt to swap out the service for a machine learning model for solving captchas (reCaptchaV2 + normal Captcha).


2) Telegram & Email Notifications

Email:

If you wish to enable Email notifications:

  1. Set email_notification_enabled1 to True.
  2. Set smtp_server1 and smtp_port1 accordingly (Default values are for gmail).
  3. Set smtp_user1 to your email address.
  4. Set smtp_pw1 to your email account password (you may have to create an App password if your account has 2FA enabled; for gmail).
  5. Set recipient_address1 to the email address to send notifications to (You should set it to be the same as smtp_user1).

Telegram:

If you wish to enable Telegram notifications:

  1. Set telegram_notification_enabled2 to True.
  2. Follow this guide to create your telegram bot.
  3. Copy the API Token generated and paste it into telegram_bot_token2.
  4. Send your bot \start on Telegram.
  5. Visit this URL: https://api.telegram.org/botBOT_TOKEN/getUpdates, replacing BOT_TOKEN with your API Token from (3).
  6. Send a test message to your bot on Telegram.
  7. There should be an new entry in the JSON on the URL you opened from (5).
  8. Copy the chat ID from the JSON (result::[X]::message::chat::id) and paste it into telegram_chat_id2.

1 - mail_config in config.yaml

2 - telegram_config in config.yaml


3A) Using setup.py:

For Windows & Linux:

Ensure that the python version you're using is python 3

$ python setup.py --intepreter_keyword "python"

If python keyword in your system points Python2, then use the keyword that points to Python3 and replace the intepreter_keyword with it accordingly.

Others:

This project isn't guaranteed to work on other operating systems. You can try building the project by following the manual steps (3B).


3B) Manually

  1. Create a virtual environment, venv, for your project.
  2. Install dependencies:
  3. $ path/to/project/venv/.../python -m pip install -r "requirements.txt"

  4. Create config.yaml file.

Running

$ path/to/project/venv/.../python src/main.py

OR, if you have main.py set to be an execeutable with a valid shebang:

$ cd path/to/project
$ src/main.py

Appendix

config.yaml

# ---------------------------- TWO-CAPTCHA CONFIG ---------------------------- #
two_captcha_config:    # This program uses the 2captcha API to solve captchas on the website. See README.md for more info.
  api_key: !KEY_HERE!
  enabled: True
  debug_mode: True
# ------------------------------------- - ------------------------------------ #


# ------------------------------- EMAIL CONFIG ------------------------------- #
mail_config:
  email_notification_enabled: False        # Whether or not to push notification to your email.

  # If you are you using a different email provider, search for its smtp_server and port.
  smtp_server: smtp.gmail.com
  smtp_port: 587

  smtp_user: !EMAIL! @gmail.com            # Your email address here.
  smtp_pw: !PASSWORD_HERE!                 # Your password here. See README.md if you use 2FA for your email.

  recipient_address: !EMAIL! @gmail.com    # Who to send the notification to.
# ------------------------------------- - ------------------------------------ #


# ---------------------------- TELEGRAM BOT CONFIG --------------------------- #
telegram_config:   # See README.md for more info on how to set up a telegram bot for this.
  telegram_notification_enabled: True  # Whether or not to push notification to telegram bot.

  telegram_bot_token: !TOKEN_HERE!
  telegram_chat_id: !CHAT_ID_HERE!
# ------------------------------------- - ------------------------------------ #


# ------------------------------ PROGRAM CONFIG ------------------------------ #
cdc_login_credentials:
  username: !USER_NAME_HERE!   # CDC Username
  password: !PASSWORD_HERE!    # CDC Password

program_config:
  auto_reserve: True           # Whether to (try and) reserve earliest available slots. User must still log in to confirm these sessions.
  reserve_for_same_day: True   # Whether to consider slots on the same days as currently booked slots.
  book_from_other_teams: True  # Whether to book from other OneTeams (User must be a OneTeam member)
  refresh_rate: 1800           # How long to wait between checks on the wesite (in seconds).

  slots_per_type:      # How many slots to try and reserve per type
    practical : 6
    btt       : 1
    rtt       : 1
    ftt       : 1
    pt        : 1

  monitored_types:     # Toggle these values for which types you want the bot to be checking for.
    practical : False
    btt       : False
    rtt       : False
    ftt       : False
    pt        : False

browser_config:
  type: firefox        # Uses firefox driver as default (other option is chrome if you have its binaries).
  headless_mode: True  # If true, selenium_driver will run without the visible UI.
# ------------------------------------- - ------------------------------------ #


# -------------------------------- LOG CONFIG -------------------------------- #
log_config:
  log_level: 1                      # 1 - DEBUG, 2 - INFO, 3 - WARN, 4- ERROR: If log_level == 3, then only WARN, ERROR will be shown in logs
  print_log_to_output: True         # Whether to prints log to console
  write_log_to_file: True           # Whether to write log to file (found in $(workspace)/logs/)
  clear_logs_init: False            # Whether to delete old log files before at the start of every execution
  appends_stack_call_to_log : False # Whether to display stack_info in log

About

A program for users of ComfortDelgro Driving Centre (CDC, SG) to monitor and reserve earlier sessions of lessons.

Topics

Resources

License

Stars

Watchers

Forks

Languages