|
|
|
@ -114,16 +114,18 @@ for p in prefixes:
|
|
|
|
|
|
|
|
|
|
if is_subnet: |
|
|
|
|
print("OK - found (active) prefix " + supernet.exploded + " that contains this range") |
|
|
|
|
strprefixlen = str(supernet.prefixlen) |
|
|
|
|
prefix_is_writable = True |
|
|
|
|
else: |
|
|
|
|
print("No suitable (active) prefix found for " + tenant_name + " which contains subnet " + scan_net.exploded) |
|
|
|
|
strprefixlen = str(scan_net.prefixlen) |
|
|
|
|
prefix_is_writable = False ;#we'll do the scan - but won't write to netbox |
|
|
|
|
#note that netbox will not stop us writing to a non-Active prefix unless the token is locked down with complex rules |
|
|
|
|
#sys.exit(2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if prefix_is_writable: |
|
|
|
|
answer = input("network " + scan_net.exploded + " Type 'n' to cancel, 'y' to scan only, 'update' to scan and enter IPs into netbox (n/y/update)") |
|
|
|
|
answer = input("network " + supernet.exploded + " Type 'n' to cancel, 'y' to scan only, 'update' to scan and enter IPs into netbox (n/y/update)") |
|
|
|
|
else: |
|
|
|
|
answer = input("network " + scan_net.exploded + " Type 'n' to cancel, 'y' to scan only (n/y)") |
|
|
|
|
|
|
|
|
@ -144,8 +146,6 @@ if do_scan:
|
|
|
|
|
scanner.run() |
|
|
|
|
for i in scanner.list_of_hosts_found: |
|
|
|
|
print(i) |
|
|
|
|
#print(str(supernet.prefixlen)) |
|
|
|
|
strprefixlen = str(supernet.prefixlen) |
|
|
|
|
if prefix_is_writable & do_update: |
|
|
|
|
try: |
|
|
|
|
result = nb.ipam.ip_addresses.create( |
|
|
|
|