异步的upnp
aioupnp的Python项目详细描述
异步的upnp
aioupnp
是一个python 3.6/7库和命令行工具,用于使用asyncio与upnp网关交互。aioupnp
需要netifaces
模块。
支持的设备
DD-WRT
miniupnpd
Actiontec GT784WN
D-Link DIR-890L
Cisco CGA4131COM
Linksys WRT1200AC
Netgear Nighthawk X4 AC2350
ASUS RT-N66U
安装
验证默认的python是python 3.6还是3.7
python --version
正常使用时的安装
pip install aioupnp
安装用于开发
git clone https://github.com/lbryio/aioupnp.git
cd aioupnp
pip install -e .
用法
aioupnp [-h] [--debug_logging] [--interface=<interface>] [--gateway_address=<gateway_address>]
[--lan_address=<lan_address>] [--timeout=<timeout>]
[(--<case sensitive m-search header>=<value>)...]
command [--<arg name>=<arg>]...
If m-search headers are provided as keyword arguments all of the headers to be used must be provided,
in the order they are to be used. For example:
aioupnp --HOST=239.255.255.250:1900 --MAN=\"ssdp:discover\" --MX=1 --ST=upnp:rootdevice m_search
命令
add_port_mapping | delete_port_mapping | get_external_ip | get_next_mapping | get_port_mapping_by_index | get_redirects | debug_gateway | generate_test_data | get_specific_port_mapping | m_search
示例
从UPnP网关获取外部IP地址
aioupnp get_external_ip
列出网关上的活动端口映射
aioupnp get_redirects
调试默认网关(非常详细)
aioupnp --debug_logging debug_gateway
调试网关发现
aioupnp --debug_logging m_search
在非默认网络接口上调试网关
aioupnp --interface=vmnet1 --debug_logging m_search
在非路由器的非默认网络接口上调试网关
aioupnp --interface=vmnet1 --gateway_address=192.168.1.106 --debug_logging m_search
许可证
aioupnp get_redirects
aioupnp --debug_logging debug_gateway
aioupnp --debug_logging m_search
aioupnp --interface=vmnet1 --debug_logging m_search
aioupnp --interface=vmnet1 --gateway_address=192.168.1.106 --debug_logging m_search
这个项目是麻省理工学院授权的。有关完整许可证,请参见LICENSE。
联系人
这个项目的主要联系人是@jackrobison