From 87915b2dd37cc6c0469d4eb51f92b579f1e4e8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxi=20Quo=C3=9F?= Date: Sun, 4 Dec 2022 11:00:46 +0100 Subject: [PATCH] add option for custom nmap args #28 --- app/backend/wol/consumers.py | 5 +++-- docker-compose-mysql.yml | 1 + docker-compose-postgres.yml | 1 + docker-compose-sqlite.yml | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/backend/wol/consumers.py b/app/backend/wol/consumers.py index 992988de..a54ddc94 100644 --- a/app/backend/wol/consumers.py +++ b/app/backend/wol/consumers.py @@ -225,7 +225,8 @@ class WSConsumer(AsyncWebsocketConsumer): day_of_week=dow, day_of_month=dom, month_of_year=month, - timezone = pytz.timezone(os.getenv("DJANGO_TIME_ZONE", "UTC")) + timezone=pytz.timezone( + os.getenv("DJANGO_TIME_ZONE", "UTC")) ) PeriodicTask.objects.update_or_create( name=f"{data['name']}-{action}", @@ -297,7 +298,7 @@ class WSConsumer(AsyncWebsocketConsumer): return p = subprocess.Popen( - ["nmap", "-sP", conf.scan_address], stdout=subprocess.PIPE) + ["nmap", os.getenv("NMAP_ARGS", "-sP"), conf.scan_address], stdout=subprocess.PIPE) out = p.communicate()[0].decode("utf-8") ip_line = "Nmap scan report for" mac_line = "MAC Address:" diff --git a/docker-compose-mysql.yml b/docker-compose-mysql.yml index 29947b36..64bd2a72 100644 --- a/docker-compose-mysql.yml +++ b/docker-compose-mysql.yml @@ -24,6 +24,7 @@ services: #- DJANGO_DEBUG=True # optional (default: False) #- DJANGO_LANGUAGE_CODE=de # optional (default: en) #- DJANGO_TIME_ZONE=Europe/Berlin # optional (default: UTC) + #- NMAP_ARGS=-sP # optional, set this if your devices need special nmap args so they can be found (default: -sP) depends_on: redis: condition: service_healthy diff --git a/docker-compose-postgres.yml b/docker-compose-postgres.yml index d86f2592..83afac76 100644 --- a/docker-compose-postgres.yml +++ b/docker-compose-postgres.yml @@ -24,6 +24,7 @@ services: #- DJANGO_DEBUG=True # optional (default: False) #- DJANGO_LANGUAGE_CODE=de # optional (default: en) #- DJANGO_TIME_ZONE=Europe/Berlin # optional (default: UTC) + #- NMAP_ARGS=-sP # optional, set this if your devices need special nmap args so they can be found (default: -sP) depends_on: redis: condition: service_healthy diff --git a/docker-compose-sqlite.yml b/docker-compose-sqlite.yml index b2862420..0b450401 100644 --- a/docker-compose-sqlite.yml +++ b/docker-compose-sqlite.yml @@ -19,6 +19,7 @@ services: #- DJANGO_DEBUG=True # optional (default: False) #- DJANGO_LANGUAGE_CODE=de # optional (default: en) #- DJANGO_TIME_ZONE=Europe/Berlin # optional (default: UTC) + #- NMAP_ARGS=-sP # optional, set this if your devices need special nmap args so they can be found (default: -sP) volumes: - ./db/:/app/backend/db/ depends_on: