2018-10-08 07:55:42 +02:00
|
|
|
[![codecov](https://codecov.io/gh/lbryio/aioupnp/branch/master/graph/badge.svg)](https://codecov.io/gh/lbryio/aioupnp)
|
2018-09-26 06:16:02 +02:00
|
|
|
|
2018-10-08 04:30:13 +02:00
|
|
|
# UPnP for asyncio
|
2018-07-30 23:48:20 +02:00
|
|
|
|
2018-10-16 15:01:25 +02:00
|
|
|
`aioupnp` is a python 3.7 library and command line tool to interact with UPnP gateways using asyncio. `aioupnp` requires the `netifaces` module.
|
2018-07-30 23:48:20 +02:00
|
|
|
|
2018-10-12 19:56:15 +02:00
|
|
|
## Supported devices
|
|
|
|
DD-WRT
|
|
|
|
miniupnpd
|
|
|
|
Actiontec GT784WN
|
|
|
|
D-Link DIR-890L
|
2018-10-18 00:58:44 +02:00
|
|
|
Cisco CGA4131COM
|
2018-10-12 19:56:15 +02:00
|
|
|
|
2018-07-30 23:48:20 +02:00
|
|
|
## Installation
|
|
|
|
|
2018-10-16 15:01:25 +02:00
|
|
|
Verify the default python is python 3.7
|
|
|
|
|
|
|
|
```
|
|
|
|
python --version
|
|
|
|
```
|
|
|
|
|
|
|
|
Installation for normal usage
|
2018-10-12 19:56:15 +02:00
|
|
|
```
|
|
|
|
pip install aioupnp
|
|
|
|
```
|
|
|
|
|
2018-10-16 15:01:25 +02:00
|
|
|
Installation for development
|
2018-07-30 23:51:59 +02:00
|
|
|
```
|
2018-10-12 19:56:15 +02:00
|
|
|
git clone https://github.com/lbryio/aioupnp.git
|
|
|
|
cd aioupnp
|
|
|
|
pip install -e .
|
2018-07-30 23:51:59 +02:00
|
|
|
```
|
2018-07-30 23:48:20 +02:00
|
|
|
|
2018-10-12 19:56:15 +02:00
|
|
|
|
2018-07-30 23:48:20 +02:00
|
|
|
## Usage
|
|
|
|
|
2018-07-31 17:35:24 +02:00
|
|
|
```
|
2018-10-12 19:56:15 +02:00
|
|
|
aioupnp [-h] [--debug_logging] [--interface=<interface>] [--gateway_address=<gateway_address>]
|
2018-10-08 07:00:42 +02:00
|
|
|
[--lan_address=<lan_address>] [--timeout=<timeout>]
|
2018-10-12 19:56:15 +02:00
|
|
|
[(--<case sensitive m-search header>=<value>)...]
|
2018-10-08 07:00:42 +02:00
|
|
|
command [--<arg name>=<arg>]...
|
2018-10-12 19:56:15 +02:00
|
|
|
|
|
|
|
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
|
2018-10-08 07:00:42 +02:00
|
|
|
```
|
2018-07-30 23:52:16 +02:00
|
|
|
|
2018-10-08 07:00:42 +02:00
|
|
|
### Commands
|
2018-10-17 16:05:07 +02:00
|
|
|
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
|
2018-07-30 23:52:16 +02:00
|
|
|
|
2018-07-30 23:48:20 +02:00
|
|
|
|
2018-10-08 23:57:45 +02:00
|
|
|
### Examples
|
2018-07-30 23:52:16 +02:00
|
|
|
|
2018-10-08 23:57:45 +02:00
|
|
|
To get the external ip address from the UPnP gateway
|
|
|
|
|
|
|
|
aioupnp get_external_ip
|
|
|
|
|
|
|
|
To list the active port mappings on the gateway
|
|
|
|
|
|
|
|
aioupnp get_redirects
|
|
|
|
|
|
|
|
To debug the default gateway
|
|
|
|
|
2018-10-12 19:56:15 +02:00
|
|
|
aioupnp --debug_logging m_search
|
2018-10-08 23:57:45 +02:00
|
|
|
|
|
|
|
To debug a gateway on a non default network interface
|
|
|
|
|
2018-10-12 19:56:15 +02:00
|
|
|
aioupnp --interface=vmnet1 --debug_logging m_search
|
2018-10-08 23:57:45 +02:00
|
|
|
|
|
|
|
To debug a gateway on a non default network interface that isn't the router
|
|
|
|
|
2018-10-12 19:56:15 +02:00
|
|
|
aioupnp --interface=vmnet1 --gateway_address=192.168.1.106 --debug_logging m_search
|
2018-10-08 23:57:45 +02:00
|
|
|
|
2018-07-30 23:48:20 +02:00
|
|
|
## License
|
|
|
|
|
|
|
|
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
|
|
|
|
|
|
|
## Contact
|
|
|
|
|
2018-10-08 07:00:42 +02:00
|
|
|
The primary contact for this project is [@jackrobison](mailto:jack@lbry.io)
|