add 2 metoths

This commit is contained in:
2026-05-20 14:10:54 +02:00
parent f17dd3f720
commit 832f3f3526
5 changed files with 166 additions and 10 deletions

View File

@@ -15,15 +15,16 @@ os.environ['PYTHONHTTPSVERIFY'] = '0'
nm = nmap.PortScanner()
# Scan the subnet for hosts (replace with your networks)
networks = [
"192.168.85.0/24",
"192.168.86.0/24"
]
networks_env = os.getenv("NETWORKS", "192.168.85.0/24,192.168.86.0/24")
networks = [network.strip() for network in networks_env.split(",") if network.strip()]
# NetBox configuration
netbox = pynetbox.api(url='https://netbox.xxxxx.xx/', token='xxxxx')
netbox_url = os.getenv("NETBOX_URL", "https://netbox.xxxxx.xx/")
netbox_token = os.getenv("NETBOX_TOKEN", "xxxxx")
ssl_verify = os.getenv("SSL_VERIFY", "false").lower() not in ("0", "false", "no", "n")
netbox = pynetbox.api(url=netbox_url, token=netbox_token, ssl_verify=ssl_verify)
tenant = "Xxxxx Praha"
tenant = os.getenv("TENANT", "Xxxxx Praha")
def scan_network(network):
print(f"Scanning network: {network}")