# ping-before-wakeonlan
Meet this Python Wake-on-LAN (WOL) Tool! It smartly checks your device status with integrated ping before sending the magic packet, ensuring efficiency. Set max wake devices, prevent power surges.
# Installation
```
% pip install ping-before-wakeonlan
```
or
```
% python3 -m venv venv
% source venv/bin/activate
% pip install ping-before-wakeonlan
% ./venv/bin/ping-before-wakeonlan
```
```
{
"count": 0,
"device": {
"failed": [],
"handled": [],
"input": [],
"online": [],
"skip": []
},
"info": [
"--device-info not set empty",
"stdin empty"
],
"maxCount": 5,
"ping": "ping -c 1 -W 3",
"version": "1.0.0"
}
usage: cmd.py [-h] [--max-wol-device MAX_WOL_DEVICE] [--send-mode {sequential,random}] [--silently] [--ping-cmd PING_CMD]
[--device-info DEVICE_INFO]
A Simple Tool for Ping and WOL Usage
options:
-h, --help show this help message and exit
--max-wol-device MAX_WOL_DEVICE
WOL device number per a run
--send-mode {sequential,random}
Adjust the order of input device
--silently Process Report
--ping-cmd PING_CMD Ping command for test device
--device-info DEVICE_INFO
a file path with JSON format with [{"ip": "192.168.1.2", "macAddress":"XX:XX:XX:XX:XX:XX"} ]
```
# Usage
```
% cat /tmp/device.json
[
{
"ip": "192.168.1.1",
"mac_address": "00:00:00:00:00:01"
},
{
"ip": "192.168.1.2",
"mac_address": "00:00:00:00:00:02"
},
{
"ip": "192.168.1.3",
"mac_address": "00:00:00:00:00:03"
},
{
"ip": "192.168.1.4",
"mac_address": "00:00:00:00:00:04"
},
{
"ip": "192.168.1.5",
"mac_address": "00:00:00:00:00:05"
},
{
"ip": "192.168.1.6",
"mac_address": "00:00:00:00:00:06"
},
{
"ip": "192.168.1.7",
"mac_address": "00:00:00:00:00:07"
}
]
% ping-before-wakeonlan --device-info /tmp/device.json
Process: 1 / 7: Device: {'ip': '192.168.1.3', 'mac_address': '00:00:00:00:00:03'}
Process: 2 / 7: Device: {'ip': '192.168.1.2', 'mac_address': '00:00:00:00:00:02'}
Process: 3 / 7: Device: {'ip': '192.168.1.1', 'mac_address': '00:00:00:00:00:01'}
Process: 4 / 7: Device: {'ip': '192.168.1.4', 'mac_address': '00:00:00:00:00:04'}
Process: 5 / 7: Device: {'ip': '192.168.1.5', 'mac_address': '00:00:00:00:00:05'}
{
"count": 5,
"device": {
"failed": [],
"handled": [
{
"ip": "192.168.1.3",
"mac_address": "00:00:00:00:00:03"
},
{
"ip": "192.168.1.2",
"mac_address": "00:00:00:00:00:02"
},
{
"ip": "192.168.1.1",
"mac_address": "00:00:00:00:00:01"
},
{
"ip": "192.168.1.4",
"mac_address": "00:00:00:00:00:04"
},
{
"ip": "192.168.1.5",
"mac_address": "00:00:00:00:00:05"
}
],
"input": [
{
"ip": "192.168.1.3",
"mac_address": "00:00:00:00:00:03"
},
{
"ip": "192.168.1.2",
"mac_address": "00:00:00:00:00:02"
},
{
"ip": "192.168.1.1",
"mac_address": "00:00:00:00:00:01"
},
{
"ip": "192.168.1.4",
"mac_address": "00:00:00:00:00:04"
},
{
"ip": "192.168.1.5",
"mac_address": "00:00:00:00:00:05"
},
{
"ip": "192.168.1.6",
"mac_address": "00:00:00:00:00:06"
},
{
"ip": "192.168.1.7",
"mac_address": "00:00:00:00:00:07"
}
],
"online": [],
"skip": [
{
"ip": "192.168.1.6",
"mac_address": "00:00:00:00:00:06"
},
{
"ip": "192.168.1.7",
"mac_address": "00:00:00:00:00:07"
}
]
},
"info": [
"cmd: ['ping', '-c', '1', '-W', '3', '192.168.1.1'], item: {'ip': '192.168.1.1', 'mac_address': '00:00:00:00:00:01'}",
"processOutput: b'PING 192.168.1.1 (192.168.1.1): 56 data bytes\\n\\n--- 192.168.1.1 ping statistics ---\\n1 packets transmitted, 0 packets received, 100.0% packet loss\\n', processError: None"
],
"maxCount": 5,
"ping": "ping -c 1 -W 3",
"status": true,
"version": "1.0.0"
}
```
or
```
% cat /tmp/device.json | ping-before-wakeonlan
```
Raw data
{
"_id": null,
"home_page": "https://github.com/changyy/ping-before-wakeonlan",
"name": "ping-before-wakeonlan",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "python,ping,wol",
"author": "Yuan-Yi Chang",
"author_email": "<changyy.csie@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/34/01/a6a5ce55ab1efb305d387e402954758ef097bb0097119d24670e04fdb206/ping-before-wakeonlan-1.0.1.tar.gz",
"platform": null,
"description": "# ping-before-wakeonlan\n\nMeet this Python Wake-on-LAN (WOL) Tool! It smartly checks your device status with integrated ping before sending the magic packet, ensuring efficiency. Set max wake devices, prevent power surges.\n\n# Installation\n\n```\n% pip install ping-before-wakeonlan\n```\n\nor\n\n```\n% python3 -m venv venv\n% source venv/bin/activate\n% pip install ping-before-wakeonlan\n% ./venv/bin/ping-before-wakeonlan\n```\n\n```\n{\n \"count\": 0,\n \"device\": {\n \"failed\": [],\n \"handled\": [],\n \"input\": [],\n \"online\": [],\n \"skip\": []\n },\n \"info\": [\n \"--device-info not set empty\",\n \"stdin empty\"\n ],\n \"maxCount\": 5,\n \"ping\": \"ping -c 1 -W 3\",\n \"version\": \"1.0.0\"\n}\nusage: cmd.py [-h] [--max-wol-device MAX_WOL_DEVICE] [--send-mode {sequential,random}] [--silently] [--ping-cmd PING_CMD]\n [--device-info DEVICE_INFO]\n\nA Simple Tool for Ping and WOL Usage\n\noptions:\n -h, --help show this help message and exit\n --max-wol-device MAX_WOL_DEVICE\n WOL device number per a run\n --send-mode {sequential,random}\n Adjust the order of input device\n --silently Process Report\n --ping-cmd PING_CMD Ping command for test device\n --device-info DEVICE_INFO\n a file path with JSON format with [{\"ip\": \"192.168.1.2\", \"macAddress\":\"XX:XX:XX:XX:XX:XX\"} ]\n```\n\n# Usage\n\n```\n% cat /tmp/device.json\n[\n {\n \"ip\": \"192.168.1.1\",\n \"mac_address\": \"00:00:00:00:00:01\"\n },\n {\n \"ip\": \"192.168.1.2\",\n \"mac_address\": \"00:00:00:00:00:02\"\n },\n {\n \"ip\": \"192.168.1.3\",\n \"mac_address\": \"00:00:00:00:00:03\"\n },\n {\n \"ip\": \"192.168.1.4\",\n \"mac_address\": \"00:00:00:00:00:04\"\n },\n {\n \"ip\": \"192.168.1.5\",\n \"mac_address\": \"00:00:00:00:00:05\"\n },\n {\n \"ip\": \"192.168.1.6\",\n \"mac_address\": \"00:00:00:00:00:06\"\n },\n {\n \"ip\": \"192.168.1.7\",\n \"mac_address\": \"00:00:00:00:00:07\"\n }\n]\n\n% ping-before-wakeonlan --device-info /tmp/device.json\nProcess: 1 / 7: Device: {'ip': '192.168.1.3', 'mac_address': '00:00:00:00:00:03'}\nProcess: 2 / 7: Device: {'ip': '192.168.1.2', 'mac_address': '00:00:00:00:00:02'}\nProcess: 3 / 7: Device: {'ip': '192.168.1.1', 'mac_address': '00:00:00:00:00:01'}\nProcess: 4 / 7: Device: {'ip': '192.168.1.4', 'mac_address': '00:00:00:00:00:04'}\nProcess: 5 / 7: Device: {'ip': '192.168.1.5', 'mac_address': '00:00:00:00:00:05'}\n{\n \"count\": 5,\n \"device\": {\n \"failed\": [],\n \"handled\": [\n {\n \"ip\": \"192.168.1.3\",\n \"mac_address\": \"00:00:00:00:00:03\"\n },\n {\n \"ip\": \"192.168.1.2\",\n \"mac_address\": \"00:00:00:00:00:02\"\n },\n {\n \"ip\": \"192.168.1.1\",\n \"mac_address\": \"00:00:00:00:00:01\"\n },\n {\n \"ip\": \"192.168.1.4\",\n \"mac_address\": \"00:00:00:00:00:04\"\n },\n {\n \"ip\": \"192.168.1.5\",\n \"mac_address\": \"00:00:00:00:00:05\"\n }\n ],\n \"input\": [\n {\n \"ip\": \"192.168.1.3\",\n \"mac_address\": \"00:00:00:00:00:03\"\n },\n {\n \"ip\": \"192.168.1.2\",\n \"mac_address\": \"00:00:00:00:00:02\"\n },\n {\n \"ip\": \"192.168.1.1\",\n \"mac_address\": \"00:00:00:00:00:01\"\n },\n {\n \"ip\": \"192.168.1.4\",\n \"mac_address\": \"00:00:00:00:00:04\"\n },\n {\n \"ip\": \"192.168.1.5\",\n \"mac_address\": \"00:00:00:00:00:05\"\n },\n {\n \"ip\": \"192.168.1.6\",\n \"mac_address\": \"00:00:00:00:00:06\"\n },\n {\n \"ip\": \"192.168.1.7\",\n \"mac_address\": \"00:00:00:00:00:07\"\n }\n ],\n \"online\": [],\n \"skip\": [\n {\n \"ip\": \"192.168.1.6\",\n \"mac_address\": \"00:00:00:00:00:06\"\n },\n {\n \"ip\": \"192.168.1.7\",\n \"mac_address\": \"00:00:00:00:00:07\"\n }\n ]\n },\n \"info\": [\n \"cmd: ['ping', '-c', '1', '-W', '3', '192.168.1.1'], item: {'ip': '192.168.1.1', 'mac_address': '00:00:00:00:00:01'}\",\n \"processOutput: b'PING 192.168.1.1 (192.168.1.1): 56 data bytes\\\\n\\\\n--- 192.168.1.1 ping statistics ---\\\\n1 packets transmitted, 0 packets received, 100.0% packet loss\\\\n', processError: None\"\n ],\n \"maxCount\": 5,\n \"ping\": \"ping -c 1 -W 3\",\n \"status\": true,\n \"version\": \"1.0.0\"\n}\n```\n\nor\n\n```\n% cat /tmp/device.json | ping-before-wakeonlan\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Meet this Python Wake-on-LAN (WOL) Tool! It smartly checks your device status with integrated ping before sending the magic packet, ensuring efficiency. Set max wake devices, prevent power surges.",
"version": "1.0.1",
"project_urls": {
"Download": "https://pypi.org/project/ping-before-wakeonlan/",
"Homepage": "https://github.com/changyy/ping-before-wakeonlan"
},
"split_keywords": [
"python",
"ping",
"wol"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c9bb6e49852929f4d851e728b4d7acb485f202b1421374ac50c7ffa5276e7c79",
"md5": "c161a440f9cc1dd9b05de25df53dcfc7",
"sha256": "d0a4a5bc4b86448b857f14b0c0628bbc11d99b8b0ec54076055be0ae3a4f9f40"
},
"downloads": -1,
"filename": "ping_before_wakeonlan-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c161a440f9cc1dd9b05de25df53dcfc7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5623,
"upload_time": "2023-10-09T04:55:57",
"upload_time_iso_8601": "2023-10-09T04:55:57.229864Z",
"url": "https://files.pythonhosted.org/packages/c9/bb/6e49852929f4d851e728b4d7acb485f202b1421374ac50c7ffa5276e7c79/ping_before_wakeonlan-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3401a6a5ce55ab1efb305d387e402954758ef097bb0097119d24670e04fdb206",
"md5": "a320d1f4b1dcb23358e66563aa70da75",
"sha256": "36a7e84191d2bbf36b8b6591a432893d48707b6a0553b9e8fff81d6b86a70c01"
},
"downloads": -1,
"filename": "ping-before-wakeonlan-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "a320d1f4b1dcb23358e66563aa70da75",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5151,
"upload_time": "2023-10-09T04:55:58",
"upload_time_iso_8601": "2023-10-09T04:55:58.656455Z",
"url": "https://files.pythonhosted.org/packages/34/01/a6a5ce55ab1efb305d387e402954758ef097bb0097119d24670e04fdb206/ping-before-wakeonlan-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-09 04:55:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "changyy",
"github_project": "ping-before-wakeonlan",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ping-before-wakeonlan"
}