Add option to disable automatic IGD mapping

This commit is contained in:
Oleksii Shevchuk 2017-03-10 00:05:31 +02:00
parent ff17852d66
commit 3aec3bf641
3 changed files with 13 additions and 1 deletions

View File

@ -89,6 +89,7 @@ class IGDClient:
def __init__(
self,
available=True,
bindIP='0.0.0.0',
ctrlURL=None,
service="WANIPC",
@ -99,6 +100,11 @@ class IGDClient:
- intIP is the source address of the request packet, which implies the source interface
- ctrlURL is the the control URL of IGD server, client will do discovery if it is None
"""
if not available:
self.ctrlURL = None
return
self.debug = edebug
self.pprint = pprint
self.isv6 = False

View File

@ -4,6 +4,7 @@
transport = ssl
port = 443
ipv6 = true
igd = true
[cmdline]
display_banner = yes

View File

@ -37,6 +37,7 @@ from pupylib import PupyServer
from pupylib import PupyDnsCnc
from pupylib import PupyCmdLoop
from pupylib import PupyCredentials
from pupylib import PupyConfig
from pupylib import __version__
from network.lib.igd import IGDClient, UPNPError
@ -87,8 +88,12 @@ if __name__=="__main__":
# Try to initialize credentials before CMD loop
PupyCredentials.Credentials()
config = PupyConfig()
try:
igd = IGDClient()
igd = IGDClient(
available=config.getboolean('pupyd', 'igd')
)
except UPNPError as e:
pass