Receives JSON data from router to notify the user (Through Desktop Notification) about various network information. The information can be sent via scripts from the router.
Very basic network related automation tool. Basically written for people too lazy to refresh the web page to check if their network is back online or not after a connection dropout. Also, notifies when the internet goes down so no more guessing game if the router crashed or something else happened.
The fucntionality can be adapted to show any kind of network related diagnostic information sent from the router by changing the messages inside the code and/or creating more API endpoints. This can show port status and so on, limited by the necessity of the user.
[✔] Windows 10
[✔] macOS
[✔] GNU/Linux
Get the code:
git clone https://github.com/m4hi2/routEar.git
Install pypoetry:
python3 -m pip install poetry
Install the required packages with:
poetry export -f requirements.txt > r.txt
pip install -r r.txt
or if you want to use it in a virtual env:
poetry install
Run the app with:
python -m routEar
Don't forget to click allow
on the firewall prompt when prompted.
I've created a windows binary using pyinstaller
and it can be found under releases. This exe file can be directly ran by double clicking it or you can put it in your startup directory. Don't forget the icon file though 🤣
Mikrotik routers have a very handy feature called tools/netwatch
that automatically pings given IP addresses and sends an interrupt based on the latency to the host. This information can be used to determined if there is internet connectivity or not. netwatch
can also be used to trigger scripts based on host availability. Using this we can easily send a request to our flask webserver that's been running on our host machine.
Example:
Netwatch Up:
/tool fetch http-method=post http-data="{\"affected\":\"internet\",\"status\":\"up\"}" output=none url="http://X.X.X.X:8000/" http-header-field="content-type: application/json"
Netwatch Down:
/tool fetch http-method=post http-data="{\"affected\":\"internet\",\"status\":\"down\"}" output=none url="http://X.X.X.X:8000/" http-header-field="content-type: application/json"
Don't forget to change X.X.X.X with the IP of your desktop. Also, use static IP for the host.
IDK man, don't have any OpenWrt box right now. Maybe some curl
stuff? no clue. If you know, please write and send a pull request. Thank You !
Join Linux Bangladesh community at kill -9. The language of the server is : Bengali (BN_BD 😉) but I'm certain we understand English as well.
Project name credit goes to Aniruddha Adhikary (I initially named it, "windowsNetworkNotifier-withRouterScripts" 🤦♂️)