From 76f6a5e8e74bbe9fadc50f6cec307078ef9c26e3 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 2 May 2024 09:18:08 -0400 Subject: [PATCH 1/3] Add netbox address format comment Clarifies format of address as protocol is required for python requests module to work --- netbox-scanner.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/netbox-scanner.conf b/netbox-scanner.conf index e36825f..3988316 100644 --- a/netbox-scanner.conf +++ b/netbox-scanner.conf @@ -1,4 +1,5 @@ [NETBOX] +# format => http(s)://IP:PORT address = token = logs = logs/ From 96b85808e9d77f81f907b75ae46a4cb5c9e381ec Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 2 May 2024 09:19:10 -0400 Subject: [PATCH 2/3] Relax requirement versions The existing requirements were not satisfiable. Removing versions causes pip to resolve automatically which still works with the project --- requirements.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0bc0275..ed9fef9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ certifi==2020.4.5.1 chardet==3.0.4 idna==2.9 pynetbox==4.3.1 -requests==2.23.0 -six==1.15.0 -urllib3==1.26.5 +requests +six +urllib3 +setuptools \ No newline at end of file From 06032d8c8b688d755bdc565010deef3f617554c4 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 2 May 2024 09:22:18 -0400 Subject: [PATCH 3/3] Log address get error --- nbs/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nbs/__init__.py b/nbs/__init__.py index ee79cc3..764a261 100644 --- a/nbs/__init__.py +++ b/nbs/__init__.py @@ -41,8 +41,9 @@ class NetBoxScanner(object): ''' try: nbhost = self.netbox.ipam.ip_addresses.get(address=host[0]) - except ValueError: - logging.error(f'duplicated: {host[0]}/32') + except ValueError as e: + logging.error(e) + logging.error(f'possibly duplicated: {host[0]}/32') self.stats['errors'] += 1 return False