diff --git a/pupy/network/lib/igd.py b/pupy/network/lib/igd.py index bd9f2c6d..307eb282 100644 --- a/pupy/network/lib/igd.py +++ b/pupy/network/lib/igd.py @@ -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 diff --git a/pupy/pupy.conf.default b/pupy/pupy.conf.default index 0124b642..d920faa1 100644 --- a/pupy/pupy.conf.default +++ b/pupy/pupy.conf.default @@ -4,6 +4,7 @@ transport = ssl port = 443 ipv6 = true +igd = true [cmdline] display_banner = yes diff --git a/pupy/pupysh.py b/pupy/pupysh.py index 9d57f589..0cb47bd8 100755 --- a/pupy/pupysh.py +++ b/pupy/pupysh.py @@ -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