diff --git a/netbox-scanner/dac.py b/netbox-scanner/dac.py index 5cf588c..d93817d 100644 --- a/netbox-scanner/dac.py +++ b/netbox-scanner/dac.py @@ -1,3 +1,10 @@ +# This script can be used sanitize the list of networks +# to be scanned. In practice, (almost) the same routine +# is executed everytime NetBoxScanner().sync() is +# called, but if you want to debug this list or even +# keep a more organized version, you can use dac.py. +## + import re from config import NETWORKS diff --git a/netbox-scanner/nbscan.py b/netbox-scanner/nbscan.py index 4773468..3eb3bf0 100644 --- a/netbox-scanner/nbscan.py +++ b/netbox-scanner/nbscan.py @@ -41,6 +41,10 @@ class NetBoxScanner(object): if not re.match(ipv4, net): return net return False + + def get_networks(self): + '''Retrieves all networks/prefixes recorded into NetBox.''' + return [str(net) for net in self.netbox.ipam.prefixes.all()] def get_description(self, address, name, cpe): '''Define a description based on hostname and CPE''' diff --git a/setup.py b/setup.py index e1a5755..95de765 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.5.5', + version='0.5.6', author='José Lopes de Oliveira Jr.', author_email='jlojunior@gmail.com', description='A scanner util for NetBox',