From c4a78cf5abd245abcbb9b1e1aa0cd141c834a803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lopes?= Date: Wed, 26 Sep 2018 15:20:36 -0300 Subject: [PATCH] minor changes --- netbox-scanner/config.py | 2 +- netbox-scanner/nbscan.py | 8 +++++--- setup.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/netbox-scanner/config.py b/netbox-scanner/config.py index 86c09fe..00b61cb 100644 --- a/netbox-scanner/config.py +++ b/netbox-scanner/config.py @@ -1,7 +1,7 @@ # netbox-scanner configuration file. NETBOX = { - 'ADDRESS': '', + 'ADDRESS': 'https://', 'TOKEN': '', 'TLS_VERIFY': True } diff --git a/netbox-scanner/nbscan.py b/netbox-scanner/nbscan.py index 0e9a823..7570c64 100644 --- a/netbox-scanner/nbscan.py +++ b/netbox-scanner/nbscan.py @@ -14,6 +14,7 @@ class NetBoxScanner(object): self.unknown = unknown def get_description(self, name, cpe): + '''Define a description based on hostname and CPE''' if name: return name else: @@ -22,6 +23,7 @@ class NetBoxScanner(object): c.get_product()[0], c.get_version()[0]) def nbhandler(self, command, **kwargs): + '''Handles NetBox integration''' if command == 'get': return self.netbox.ipam.ip_addresses.get( address=kwargs['address']) @@ -41,7 +43,7 @@ class NetBoxScanner(object): :param network: a valid network, like 10.0.0.0/8 :return: a list with dictionaries of responsive - hosts (addr and description) + hosts (address and description) ''' hosts = [] nm = PortScanner() @@ -62,7 +64,7 @@ class NetBoxScanner(object): '''Scan some networks and sync them to NetBox. :param networks: a list of valid networks, like ['10.0.0.0/8'] - :return: nothing will be returned + :return: synching statistics are returned as a tuple ''' create = update = delete = undiscovered = duplicate = 0 for net in networks: @@ -103,7 +105,7 @@ class NetBoxScanner(object): self.nbhandler('delete', nbhost=nbhost) delete += 1 else: - logging.info('undiscovered: {} "{}"'.format( + logging.warning('undiscovered: {} "{}"'.format( nbhost.address, nbhost.description)) undiscovered += 1 except AttributeError: diff --git a/setup.py b/setup.py index f8b2747..d90e9f4 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.md', 'r') as fh: setuptools.setup( name='netbox-scanner', - version='0.3.1', + version='0.3.2', author='José Lopes de Oliveira Jr.', author_email='jlojunior@gmail.com', description='A scanner util for NetBox',