https://github.com/urpagin/wol_api
https://github.com/urpagin/wol_api
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/urpagin/wol_api
- Owner: Urpagin
- Created: 2023-03-12T14:20:50.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-18T22:12:27.000Z (about 1 year ago)
- Last Synced: 2025-01-19T12:12:33.310Z (5 months ago)
- Language: Python
- Size: 63.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wake on Lan API
Python REST API that wakes a machine (that supports wol) from outside of the local network.
### 🐳 Docker
```bash
git clone https://github.com/Urpagin/WoL_Api/
```
```bash
cd WoL_Api
```
```bash
vim .env
```
Then populate .env with `HASHED_KEY=`
Use [this webpage](https://emn178.github.io/online-tools/sha384.html) to hash your password using the SHA384 hashing algorithm.
```bash
docker build -t urpagin/wol-api:0.0.1 .
```
```bash
docker images
```
Then copy image ID
```bash
docker run -d --restart=always --network host --name wol-api
```
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": }`
Note X2: before using `/wake` make sure you added the machine's mac address to the database with `/add-machine`


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