Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c89078d

Browse files
authoredNov 17, 2023
Merge pull request #54 from cisagov/metadata-refresh-11-17-23
Metadata refresh 11 17 23
2 parents afa9734 + d2a8143 commit c89078d

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed
 

‎.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/network-architecture-verification-and-validation.iml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/navv/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""This file defines the version of this module."""
2-
__version__ = "3.3.1"
2+
__version__ = "3.3.2"

‎src/navv/spreadsheet_tools.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def get_inventory_data(ws, **kwargs):
9393
ip=row[0].value,
9494
name=row[1].value,
9595
color=(copy(row[0].fill), copy(row[0].font)),
96+
mac_address="",
97+
vendor=""
9698
)
9799
return inventory
98100

@@ -262,14 +264,17 @@ def handle_ip(ip_to_check, dns_data, inventory, segments, ext_IPs, unk_int_IPs):
262264
* DHCP Broadcasting
263265
* Multicast
264266
* Within Segments identified
265-
* Within Inventory, not within an Identified Segment
267+
* Resolution by DNS, then Inventory, and then Unknown
268+
* Appends name if External IP
266269
* Private Network
270+
* Resolution by DNS, Inventory, then Unknown
267271
* External (Public IP space) or Internet
272+
* Resolution by DNS, Unknown
268273
269274
This will capture the name description and the color coding identified within the worksheet.
270275
"""
271276
segment_ips = [segment.network for segment in segments]
272-
desc_to_change = ("Unknown IP Address", IPV6_CELL_COLOR)
277+
desc_to_change = ("Not Triggered IP", IPV6_CELL_COLOR)
273278
if ip_to_check == str("0.0.0.0"):
274279
desc_to_change = (
275280
"Unassigned IPv4",
@@ -288,39 +293,42 @@ def handle_ip(ip_to_check, dns_data, inventory, segments, ext_IPs, unk_int_IPs):
288293
IPV6_CELL_COLOR,
289294
)
290295
elif ip_to_check in segment_ips:
291-
for segment in segments[:-1]:
292-
if ip_to_check not in segment.network:
293-
continue
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:
297-
desc_to_change = (inventory[ip_to_check].name, segment.color)
298-
else:
296+
for x in range(0, len(segments[:-1])):
297+
if segments[x].network == ip_to_check:
298+
if ip_to_check in dns_data:
299+
resolution = dns_data[ip_to_check].name
300+
elif ip_to_check in inventory:
301+
resolution = inventory[ip_to_check].name
302+
else:
303+
resolution = f"Unknown device in {segments[x].name} network"
304+
unk_int_IPs.add(ip_to_check)
305+
if not netaddr.IPAddress(ip_to_check).is_private():
306+
resolution = resolution + " {Non-Priv IP}"
299307
desc_to_change = (
300-
f"Unknown device in {segment.name} network",
301-
segment.color,
302-
)
303-
unk_int_IPs.add(ip_to_check)
304-
elif ip_to_check in inventory:
305-
desc_to_change = (inventory[ip_to_check].name, inventory[ip_to_check].color)
308+
resolution,
309+
segments[x].color,
310+
)
306311
elif netaddr.IPAddress(ip_to_check).is_private():
307312
if ip_to_check in dns_data:
308313
desc_to_change = (dns_data[ip_to_check], INTERNAL_NETWORK_CELL_COLOR)
314+
elif ip_to_check in inventory:
315+
desc_to_change = (inventory[ip_to_check].name, INTERNAL_NETWORK_CELL_COLOR)
309316
else:
310317
desc_to_change = ("Unknown Internal address", INTERNAL_NETWORK_CELL_COLOR)
311318
unk_int_IPs.add(ip_to_check)
312319
else:
313320
ext_IPs.add(ip_to_check)
314-
resolution = "Unresolved external address"
315321
if ip_to_check in dns_data:
316322
resolution = dns_data[ip_to_check]
323+
elif ip_to_check in inventory:
324+
resolution = inventory[ip_to_check].name + " {Non-Priv IP}"
317325
else:
318326
try:
319327
resolution = socket.gethostbyaddr(ip_to_check)[0]
320328
except socket.herror:
321329
ALREADY_UNRESOLVED.append(ip_to_check)
322330
finally:
323-
dns_data[ip_to_check] = resolution
331+
resolution = "Unresolved external address"
324332
desc_to_change = (resolution, EXTERNAL_NETWORK_CELL_COLOR)
325333
return desc_to_change
326334

0 commit comments

Comments
 (0)
Please sign in to comment.