@@ -269,6 +269,7 @@ def handle_ip(ip_to_check, dns_data, inventory, segments, ext_IPs, unk_int_IPs):
269
269
This will capture the name description and the color coding identified within the worksheet.
270
270
"""
271
271
segment_ips = [segment .network for segment in segments ]
272
+ desc_to_change = ("Unknown IP Address" , IPV6_CELL_COLOR )
272
273
if ip_to_check == str ("0.0.0.0" ):
273
274
desc_to_change = (
274
275
"Unassigned IPv4" ,
@@ -290,9 +291,9 @@ def handle_ip(ip_to_check, dns_data, inventory, segments, ext_IPs, unk_int_IPs):
290
291
for segment in segments [:- 1 ]:
291
292
if ip_to_check not in segment .network :
292
293
continue
293
- if ip_to_check in dns_data :
294
- desc_to_change = (dns_data [ip_to_check ], segment .color )
295
- if ip_to_check in inventory :
294
+ elif ip_to_check in dns_data :
295
+ desc_to_change = (dns_data [ip_to_check ] , segment .color )
296
+ elif ip_to_check in inventory :
296
297
desc_to_change = (inventory [ip_to_check ].name , segment .color )
297
298
else :
298
299
desc_to_change = (
@@ -310,13 +311,13 @@ def handle_ip(ip_to_check, dns_data, inventory, segments, ext_IPs, unk_int_IPs):
310
311
unk_int_IPs .add (ip_to_check )
311
312
else :
312
313
ext_IPs .add (ip_to_check )
314
+ resolution = "Unresolved external address"
313
315
if ip_to_check in dns_data :
314
316
resolution = dns_data [ip_to_check ]
315
317
else :
316
318
try :
317
319
resolution = socket .gethostbyaddr (ip_to_check )[0 ]
318
320
except socket .herror :
319
- resolution = "Unresolved external address"
320
321
ALREADY_UNRESOLVED .append (ip_to_check )
321
322
finally :
322
323
dns_data [ip_to_check ] = resolution
0 commit comments