7 Star 21 Fork 5

李波 / wakeonlan

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.rst 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
路之遥 提交于 2019-02-26 16:57 . 修改readme

wakeonlan

一个python制作的魔术唤醒包工具

安装wakeonlan模块

执行下面2行命令,生成安装包,然后切换到dist目录, 使用第3行命令安装包。 安装以后就可以用cmd输入wakeonlan命令测试使用。

1.python setup.py bdist_egg

2.python setup.py sdist

3.pip install wakeonlan-0.1*.tar.gz

注意:要想唤醒成功,必须把目标主机BIOS和电源相关设置弄好,具体可以百度。

作为模块使用

  • Import the module
>>> from wakeonlan.wakeonlan import *
  • Wake up a single computer by its mac address
>>> send_magic_packet('ff.ff.ff.ff.ff.ff')
  • Wake up multiple computers by their mac addresses.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', '00-00-00-00-00-00',
...                   'FFFFFFFFFFFF')
  • An external host may be specified. Do note that port forwarding on that host is required. The default ip address is 255.255.255.255 and the default port is 9.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff',
...                   ip_address='example.com',
...                   port=1337)

作为命令行使用

usage: wakeonlan [-h] [-i ip] [-p port] mac address [mac address ...]

Wake one or more computers using the wake on lan protocol.

positional arguments:
  mac address  The mac addresses or of the computers you are trying to wake.

optional arguments:
  -h, --help   show this help message and exit
  -i ip        The ip address of the host to send the magic packet to.
               (default 255.255.255.255)
  -p port      The port of the host to send the magic packet to (default 9)

Dependencies

Python3.x
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/libolink/wakeonlan.git
git@gitee.com:libolink/wakeonlan.git
libolink
wakeonlan
wakeonlan
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891