e-Dnevnik grade/exam alerting system

e-dnevnik-bot

GitHub license GitHub release

About / Opće informacije

e-Dnevnik bot is a self-hosting alerting system which reads from the official CARNet e-Dnevnik which regularly polls for new information (ie. new grades for all lecture subjects, new scheduled exams, etc).

Bot is able to login as multiple AAI/AOSI users from skole.hr and check for new information for all of them either in a single-run or as a service, doing polls in regular intervals (ie. hourly). All new alerts (previously not seen) will be alerted on. This bot is able to send alerts through the following message systems and/or services:

Each alert can be broadcasted through multiple services and each of those services can have multiple recipients. All and any authentication information remains on your PC and/or server alone.

--

e-Dnevnik je bot i obavjesni sustav koji se izvršava u potpunosti kod krajnjeg korisnika, a zamišljen je kao nadogradnja na CARNet e-Dnevnik. Korisnik pri tome više ne mora redovno otvarati e-Dnevnik u potrazi za novim informacijama. Bot može jednokratno ili u redovnim intervalima dohvaćati nove informacije o predmetima (nove ocjene i novi zakazani ispiti).

Bot se može autenticirati kao različiti AAI/AOSI korisnici iz skole.hr domene, te može provjeravati informacije bilo jednokratno, bilo kao servis koji povlači informacije u redovnim intervalima. Bot će poslati sve obavijesti za sve nove događaje koji do sad nisu prikazani, a može ih slati kroz različite sustave slanja poruka:

Svaka ta poruka će se proslijediti kroz jedan ili više servisa i svaki navedeni servis može imati konfiguranog jednog ili više primatelja. Autentikacijski podaci za sve navedeno ostaju isključivo lokalno i ne napuštaju vaše računalo i/ili server.

Requirements / Zahtjevi za rad

Bot needs:

  • a folder to run from as well as some (very small) amount of disk space for the database: 1 MiB of disk space for ~50 grades,
  • AAI/AOSI logins belonging to skole.hr domain for e-Dnevnik,
  • one or more Discord, Telegram, Slack or e-mail messaging accounts.

Bot will be most likely able to run on any embedded device and on any supported operating system, as it uses ~20-25MB RSS during regular operation as a service.

--

Bot za rad treba:

  • direktorij iz kojeg će raditi te koji će sadržavati bazu podataka za poslane poruke, cca 1 MiB prostora za cca 50ak ocjena,
  • AAI/AOSI korisničke podatke iz skole.hr domene za pristup e-Dnevniku,
  • jedan ili više Discord, Telegram, Slack ili e-mail korisničkih računa.

Bot bi trebao moći funkcionirati na bilo kakvom embedded računalu (Raspberry Pi itd.) kao i bilo kakvom podržanom operativnom sustavu, te koristi cca 20-25MB radne memorije tijekom rada.

Installation / Instalacija

Just download the binary from the releases page as well as the configuration file.

--

Za instalaciju dovoljno je skinuti izvršnu datoteku sa releases stranice te konfiguracijsku datoteku.

Usage / Upute za upotrebu

Usage: e-dnevnik-bot [-?dtv] [-b value] [-f value] [-i value] [parameters ...]
 -?, --help     display help
 -b, --database=value
                alert database file [.e-dnevnik.db]
 -d, --daemon   enable daemon mode (running as a service)
 -f, --conffile=value
                configuration file (in TOML) [.e-dnevnik.toml]
 -i, --interval=value
                interval between polls when in daemon mode [1h]
 -t, --test     send a test event (to check if messaging works)
 -v, --verbose  enable verbose/debug log level

Typically bot will run from current working directory and attempt to load TOML configuration from .e-dnevnik.toml file or the file specified with -f flag.

Other flags are:

  • -b: alert database file path used to mark seen alerts (default is .e-dnevnik.db),
  • -d: enable daemon mode aka service mode where bot works continously, waking up on regular intervals (specified with -i) and by default this is disabled,
  • -f: configuration file path to configure usernames, passwords and various messaging services (in TOML format),
  • -i: interval between polls when in daemon/service mode (at minimum 1h, default 1h),
  • -t: sends a test message to all configured messaging services,
  • -v: enables verbose/debug messages for more insight into bot operation and by default this is disabled.

--

Bot se koristi iz tekućeg direktorija u kojem se nalazi i izvršna datoteka i pokušati će učitati datoteku .e-dnevnik.toml koja je u TOML sintaksi, odnosno učitati će datoteku specificiranu kroz -f parametar.

Ostali parametri su:

  • -b: staza do baze poslanih obavijesti (standardno je to .e-dnevnik.db iz tekućeg direktorija),
  • -d: omogućuje servisni rad gdje bot radi kontinuirano i budi se u regularnim intervalima (koje odabiremo sa -i parametrom) te je ovakav način rada standardno ugašen,
  • -f: staza do konfiguracijske datoteke koja sadrži korisnička imena, lozinke i ostalu konfiguraciju za servise slanja poruka odnosno e-maila (u TOML sintaksi),
  • -i: interval između buđenja bota (minimalno 1h, standardno 1h),
  • -t: služi za slanje testne poruke na sve konfigurirane servise slanja poruka odnosno e-maila,
  • -v: omogućuje prikaz više informacija o radu servisa, te je standardno ova opcija ugašena.

Configuration / Konfiguracija

Configuration has several blocks. User configuration can be repeated as many times as needed, while Telegram, Discord, Slack and e-mail configuration blocks can be appear only once, but they can be all enabled and disabled as needed. Targets (User IDs, Chat IDs and To) are defined as arrays and permit as many receivers as needed. Alerts are broadcasted to all of chat services or e-mail service at once.

--

Konfiguracija ima nekoliko blokova. Konfiguracija za korisnika se može ponavljati nekoliko puta za različite korisnike iz @skole.hr domene. Konfiguracije za Telegram, Discord, Slack i e-mail se mogu odnosno smiju pojaviti samo jednom ali mogu biti omogućene sve po potrebi. Odredišta (User ID, Chat ID, To) su sva definirana kao vektori i dozvoljavaju unošenje koliko je god potrebno odredišta koliko treba. Sve obavijesti se šalju istovremeno na sve servise odnosno e-mail.

User configuration

[[user]]
username = "[email protected]"
password = "lozinka"

It is possible to specify as many of user blocks as needed and they will all get processed in parallel.

--

Moguće je definirati koliko je god potrebno korisnika i podaci za sve će se dohvaćati i obrađivati istovremeno.

Telegram configuration

[telegram]
token = "telegram_bot_token"
chatids = [ "chat_id", "chat_id2" ]

Steps required:

  1. Create a Telegram bot by following the official Telegram bot HOWTO, which amounts to messaging BotFather and doing a few simple steps.
  2. When you create a bot, you will need to message it directly from each Telegram account you plan to configure for the bot to message and find Chat IDs, typically by using https://api.telegram.org/botTOKEN/getUpdates and replacing TOKEN with the Bot Token you got from step 1.

--

Potrebni koraci:

  1. Stvara se Telegram bot prateći službene upute, što se svodi na slanje poruke BotFather korisniku i praćenje dobivenih uputa.
  2. Kada se dovrši prethodni korak i bot je stvoren, treba mu poslati poruku sa svakog Telegram accounta kojeg želimo dodati kao korisnika. Chat ID se zatim može pronaći koristeći https://api.telegram.org/botTOKEN/getUpdates link u kojem ste zamijenili riječ TOKEN sa Bot Token zapisom iz koraka 1.

Discord configuration

[discord]
token = "discord_bot_token"
userids = [ "user_id", "user_id2" ]

Steps required:

  1. Create a Discord bot by following the Discord bot HOWTO. This step requires both creating a bot and inviting it to your server.
  2. Permissions neded should be set only to Send Messages and nothing else,
  3. You can find User IDs by enabling Developer Mode in your Discord client after messaging your bot.

--

Potrebni koraci:

  1. Stvara se Discord bot prateći neslužbene upute. Ovaj korak podrazumijeva i stvaranje bota i pozivanje njega na vlastiti server.
  2. Potrebne dozvole su isključivo one za slanje poruka odnosno Send Messages.
  3. Moguće je pronaci User ID tako da se upali način razvijanja odnosno Developer Mode u Discord klijentu i pogleda u chatu koji se otvori nakon slanja poruke botu.

Slack configuration

[slack]
token = "xoxb-slack_bot_token"
chatids = [ "chat_id", "chat_id2" ]

Steps required:

  1. Create a Slack bot by following the official Slack bot HOWTO.
  2. Permissions that are needed are only chat:write.
  3. Chat IDs can be copied from Slack user interface, just click either on a desired username, then View full profile, then Copy member ID. Channel ID can be also used instead, when sending a group message.

--

Potrebni koraci:

  1. Stvara se Slack bot prateći službene upute.
  2. Potrebne dozvole su isključivo chat:write.
  3. Chat ID se može naći iz Slack klijenta, dovoljno je kliknuti na željenog korisnika, zatim View full profile te onda Copy member ID. Moguće je koristiti i Channel ID ako Slack bot treba slati grupne poruke.

Mail/SMTP configuration

[mail]
server = "smtp.gmail.com"
port = "587"
username = "[email protected]"
password = "legacy_app_password"
from = "[email protected]"
subject = "Nova ocjena iz e-Dnevnika"
to = [ "[email protected]", "[email protected]" ]

Steps required:

  1. Gmail SMTP configuration can be set up by following Gmail Help Center answer. Other SMTP services follow the similar, self-explanatory configuration.

--

Potrebni koraci:

  1. Gmail SMTP konfiguraciju je moguće složiti koristeći odgovor sa Google centra za pomoć. Svi ostali SMTP servisi se slično konfiguriraju.

HOWTO

Integration with Systemd

To have minimal systemd configuration with the service running as user ubuntu inside /home/ubuntu/e-dnevnik directory, the following file should be saved to /etc/systemd/system/e-dnevnik.service:

# /etc/systemd/system/e-dnevnik.service
[Unit]
Description=e-Dnevnik daemon
After=network-online.target

[Service]
WorkingDirectory=/home/ubuntu/e-dnevnik
ExecStart=/home/ubuntu/e-dnevnik/e-dnevnik-bot --daemon --verbose

Restart=always
RestartSec=2
User=ubuntu
Group=ubuntu

[Install]
WantedBy=multi-user.target

Steps to enable would be as usual:

systemctl daemon-reload
systemctl enable --now e-dnevnik
systemctl status e-dnevnik

Running as a Docker container

We have up to date Docker Hub builds that can be used to run bot as Linux amd64/arm64/arm containers. To set this up, we need a persistent directory named ednevnik on host in a local folder containing configuration file .e-dnevnik-toml. That same directory will also store persistent alerts database named .e-dnevnik.db as well, and we will do a classic volume mount from host to container:

cd some/workdir
mkdir ednevnik

curl https://raw.githubusercontent.com/dkorunic/e-dnevnik-bot/main/.e-dnevnik.toml.example \
    --output ednevnik/.e-dnevnik.toml
editor ednevnik/.e-dnevnik.toml

docker pull dkorunic/e-dnevnik-bot

docker run --detach \
    --volume "$(pwd)/ednevnik:/ednevnik" \
    --restart unless-stopped \
    dkorunic/e-dnevnik-bot \
    --daemon \
    --verbose \
    --database /ednevnik/.e-dnevnik.db \
    --conffile /ednevnik/.e-dnevnik.toml
Owner
Dinko Korunic
If I had 8 hours to chop down a tree, I would spend 6 of those hours sharpening my axe.
Dinko Korunic
Similar Resources

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for. Screenshots First, input PIN Then enjoy! Hoste

Mar 11, 2022

Open source framework for processing, monitoring, and alerting on time series data

Kapacitor Open source framework for processing, monitoring, and alerting on time series data Installation Kapacitor has two binaries: kapacitor – a CL

Dec 24, 2022

Time Series Alerting Framework

Bosun Bosun is a time series alerting framework developed by Stack Exchange. Scollector is a metric collection agent. Learn more at bosun.org. Buildin

Dec 27, 2022

Time Series Alerting Framework

Bosun Bosun is a time series alerting framework developed by Stack Exchange. Scollector is a metric collection agent. Learn more at bosun.org. Buildin

Dec 27, 2022

Open source framework for processing, monitoring, and alerting on time series data

Kapacitor Open source framework for processing, monitoring, and alerting on time series data Installation Kapacitor has two binaries: kapacitor – a CL

Dec 26, 2022

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

Sampler. Visualization for any shell command. Sampler is a tool for shell commands execution, visualization and alerting. Configured with a simple YAM

Dec 28, 2022

AWS Cloudtrail event alerting lambda function. Send alerts to Slack, Email, or SNS.

AWS Cloudtrail event alerting lambda function. Send alerts to Slack, Email, or SNS.

Cloudtrail-Tattletail is a Lambda based Cloudtrail alerting tool. It allows you to write simple rules for interesting Cloudtrail events and forward those events to a number of different systems.

Jan 6, 2023

Script Based Alerting Manager

Script Based Alerting Manager

A Project in active development. Features may have breaking changes at any time before v1.0.0 version Telegram Group Balerter is a scripts based alert

Dec 27, 2022

An Alert notification service is an application which can receive alerts from certain alerting systems like System_X and System_Y and send these alerts to developers in the form of SMS and emails.

Alert-System An Alert notification service is an application which can receive alerts from certain alerting systems like System_X and System_Y and sen

Dec 10, 2021

Rekor-sidekick - Rekor transparency log monitoring and alerting

🔍 Rekor Sidekick Rekor Sidekick monitors a Rekor signature transparency log and

Nov 26, 2022

The wazuh-integratord is a daemon that allows Wazuh to connect to external APIs and alerting tools such as Slack, VirusTotal and PagerDuty.

The wazuh-integratord is a daemon that allows Wazuh to connect to external APIs and alerting tools such as Slack, VirusTotal and PagerDuty.

Apr 22, 2022

Butler - Aggregation and Alerting Platform

Butler - Aggregation and Alerting Platform

Welcome to Butler Table of Contents Welcome About The Project Contributing Developer Workflow Getting Started Configuration About The Project Contribu

Mar 1, 2022

Cloudinsight Agent is a system tool that monitors system processes and services, and sends information back to your Cloudinsight account.

Cloudinsight Agent 中文版 README Cloudinsight Agent is written in Go for collecting metrics from the system it's running on, or from other services, and

Nov 3, 2022

System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

Vegeta is a system resource usage tracking tool built to regularly take snapshots of the memory and CPU load of one or more running processes, so as to dynamically build up a profile of their usage of system resources.

Jan 16, 2022

remindme is a simple application to set reminders from the CLI that integrates with your system's notification system.

remindme is a simple application to set reminders from the CLI that integrates with your system's notification system.

remindme remindme is a simple application to set reminders from the CLI that integrates with your system's notification system. Examples Once the serv

Nov 24, 2022

CBuild build system - A tiny build system for C

cuild - CBuild A build system for C Building $ go build . Usage Similar to GNU Make, a file named "Cuildfile" is required. You have a few flags to us

Jan 17, 2022

get windows system call number dynamically, it doesn't need the system call table.

GetSyscallID get windows system call number dynamically, it doesn't need the system call table. Try download go get github.com/akkuman/getsyscallid/cm

Jun 1, 2022
Comments
  • Više škola za jednog učenika

    Više škola za jednog učenika

    Hi Dinko, hvala puno na ovome, definitivno će olakšati praćenje stanja u dnevniku.

    Upogonio sve kroz docker-compose, radi super, no primjetio sam issue da se ne refresha stanje ukoliko učenik pohađa dvije škole istovremeno. Uredno stižu obavijesti za dijete sa jednim razredom, no za drugo nikad nije došlo ništa.

    Dijete mi pohađa uz osnovnu i glazbenu, kod nje nakon logina u browseru dobivam na odabir za koji razred želim info.

    image

    Upalio verbose log pa dobijem ovaj error:

    {"level":"warn","time":"2023-02-28T17:26:07Z","message":"error scraping data for user [email protected]: All attempts fail:\n#1: vCalendar not found\n#2: could not find CSRF token\n#3: could not find CSRF token"}

    Kroz browser u dev consoli vidim da odabir razreda radi HTTP request na

    https://ocjene.skole.hr/class_action/[:id razreda:]/course Što završi kao 302 redirect nazad na https://ocjene.skole.hr/course

    Koliko vidim razlika je u tome što učenik sa jednim aktivnim razredom ima automatski landing page na https://ocjene.skole.hr/course

    Dok učenik s 2 aktivna razreda ima landing page podešen kao: https://ocjene.skole.hr/class

    Ovaj drugi link radi, ukoliko ga se unese ručno, čak i za učenika sa jednim razredom, pa vjerujem da se može iskoristiti za debugging

  • Added

    Added "--daemon" command to docker compose

    --daemon command will enable daemon mode (running as a service). Otherwise, docker will restart with the message "Service is not enabled, doing just a single run".

Code portion for Distributed System Final exam for Viktor Máni Mønster

DISYS Final Exam (Distributed Hash Table) How to run There are two components of the system, which need to be run in separate ways. As this is a distr

Jan 5, 2022
Fizzbuzz exam project

Golang-fizzbuzz Golang Fizzbuzz. This README is made up of two parts: the first one will give you basic instructions to easily install this applicatio

Nov 3, 2022
checkah is an agentless SSH system monitoring and alerting tool.

CHECKAH checkah is an agentless SSH system monitoring and alerting tool. Features: agentless check over SSH (password, keyfile, agent) config file bas

Oct 14, 2022
Production-Grade Container Scheduling and Management
Production-Grade Container Scheduling and Management

Kubernetes (K8s) Kubernetes, also known as K8s, is an open source system for managing containerized applications across multiple hosts. It provides ba

Dec 28, 2022
Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform
Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform

CDS: Continuous Delivery Service CDS is an Enterprise-Grade Continuous Delivery & DevOps Automation Platform written in Go(lang). This project is unde

Jan 4, 2023
A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC
 A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC

Introduction kcp-go is a Production-Grade Reliable-UDP library for golang. This library intents to provide a smooth, resilient, ordered, error-checked

Dec 28, 2022
Production-Grade Container Scheduling and Management
Production-Grade Container Scheduling and Management

Kubernetes (K8s) Kubernetes, also known as K8s, is an open source system for managing containerized applications across multiple hosts. It provides ba

Jan 2, 2023
Vektor - Build production-grade web services quickly
Vektor - Build production-grade web services quickly

Vektor enables development of modern web services in Go. Vektor is designed to simplify the development of web APIs by eliminating boilerplate, using secure defaults, providing plug-in points, and offering common pieces needed for web apps. Vektor is fairly opinionated, but aims to provide flexibility in the right places.

Dec 15, 2022
Enterprise-grade application development platform

Erda Overview Feature list Architecture Related repositories erda-proto erda-infra erda-ui Quick start To start using erda To start developing erda Do

Dec 28, 2022
Enterprise-grade container platform tailored for multicloud and multi-cluster management
Enterprise-grade container platform tailored for multicloud and multi-cluster management

KubeSphere Container Platform What is KubeSphere English | 中文 KubeSphere is a distributed operating system providing cloud native stack with Kubernete

Jan 2, 2023