Skip to content

Commit

Permalink
Adding the MAC adress to method host.get_dict()
Browse files Browse the repository at this point in the history
When host is down, mac_addr = None
  • Loading branch information
Debra Jules authored and savon-noir committed Dec 6, 2020
1 parent 84599f7 commit 58b0d0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libnmap/objects/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ def get_dict(self):
"address": self.address,
"status": self.status,
"hostnames": " ".join(self._hostnames),
"mac_addr": self._mac_addr,
}
)

return d

def diff(self, other):
Expand Down
7 changes: 7 additions & 0 deletions libnmap/test/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@


class TestNmapHost(unittest.TestCase):
def setUp(self):
self.fdir = os.path.dirname(os.path.realpath(__file__))
self.dionaea_path = "{0}/files/dionaea_scan.xml"

def test_eq_host(self):
h1 = NmapParser.parse(host1)
h2 = NmapParser.parse(host2)
Expand Down Expand Up @@ -218,6 +222,7 @@ def test_diff_host(self):
"NmapService::tcp.3306",
"address",
"NmapService::tcp.25",
"mac_addr",
]
),
)
Expand All @@ -236,6 +241,7 @@ def test_diff_host(self):
"NmapService::tcp.22",
"NmapService::tcp.111",
"address",
"mac_addr",
]
),
)
Expand All @@ -253,6 +259,7 @@ def test_diff_host(self):
"NmapService::tcp.22",
"NmapService::tcp.111",
"address",
"mac_addr",
]
),
)
Expand Down

0 comments on commit 58b0d0a

Please sign in to comment.