Urpagin / WoL_Api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wake on Lan API

Python REST API that wakes a machine (that supports wol) from outside of the local network.

🐳 Docker

git clone https://github.com/Urpagin/WoL_Api/
cd WoL_Api
vim .env

Then populate .env with HASHED_KEY=<HASHEDKEY>
Use this webpage to hash your password using the SHA384 hashing algorithm.

docker build -t urpagin/wol-api:0.0.1 .
docker images

Then copy image ID

docker run -d --restart=always --network host --name wol-api <IMAGEID>

It's all good man. Now you can execute docker ps to show all running containers or docker ps -a to show all running and exited containers in case wol-api crashed.

⚙️ API

/(GET): simple static HTTP to check the API
/wake(POST): takes key and ip wakes a machine with pagic packet
/ping(GET): takes key and ip returns the ping response of the machine
/add-machine(PUT): takes key and ip gets the mac address of ip and ands the tuple (ip, mac) into database
/database(GET): takes key returns the database content in the form of a list.

Note: all responses are json {"detail": <RESPONSE>}
Note X2: before using /wake make sure you added the machine's mac address to the database with /add-machine

programming-background-with-person-working-with-codes-computer (1)

Hero-Wodaabe-nomads-in-Chad-Photo-credit-Tariq-Zaidi-Zuma-Press-01

flag-india

Image Credits: Image by www.slon.pics on Freepik

About


Languages

Language:Python 75.4%Language:HTML 20.9%Language:Dockerfile 3.7%