Add tests for port and protocol validation and update changelog

This commit is contained in:
Marek Wolan
2024-09-26 16:00:59 +01:00
parent f2b6d68b14
commit 203ec5ec85
7 changed files with 56 additions and 7 deletions

View File

@@ -1839,15 +1839,14 @@ class Node(SimComponent):
def show_open_ports(self, markdown: bool = False):
"""Prints a table of the open ports on the Node."""
table = PrettyTable(["Port", "Name"])
table = PrettyTable(["Port"])
if markdown:
table.set_style(MARKDOWN)
table.align = "l"
table.title = f"{self.hostname} Open Ports"
for port in self.software_manager.get_open_ports():
if port > 0:
# TODO: do a reverse lookup for port name, or change this to only show port int
table.add_row([port, port])
table.add_row([port])
print(table.get_string(sortby="Port"))
@property