Skip to content

Commit

Permalink
Merge branch 'issue42'
Browse files Browse the repository at this point in the history
  • Loading branch information
savon-noir committed Nov 22, 2014
2 parents 2cdcbf3 + 1e0c352 commit 56c7800
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libnmap/objects/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ def __init__(self, starttime='', endtime='', address=None, status=None,
self._ipv4_addr = None
self._ipv6_addr = None
self._mac_addr = None
self._vendor = None
for addr in address:
if addr['addrtype'] == "ipv4":
self._ipv4_addr = addr['addr']
elif addr['addrtype'] == 'ipv6':
self._ipv6_addr = addr['addr']
elif addr['addrtype'] == 'mac':
self._mac_addr = addr['addr']
if 'vendor' in addr:
self._vendor = addr['vendor']

self._main_address = self._ipv4_addr or self._ipv6_addr or ''
self._address = address
Expand Down Expand Up @@ -147,8 +150,10 @@ def address(self, addrdict):
self._ipv4_addr = addrdict['addr']
elif addrdict['addrtype'] == 'ipv6':
self._ipv6_addr = addrdict['addr']
if addrdict['addrtype'] == 'mac':
elif addrdict['addrtype'] == 'mac':
self._mac_addr = addrdict['addr']
if 'vendor' in addrdict:
self._vendor = addrdict['vendor']

self._main_address = self._ipv4_addr or self._ipv6_addr or ''
self._address = addrdict
Expand All @@ -171,6 +176,15 @@ def mac(self):
"""
return self._mac_addr or ''

@property
def vendor(self):
"""
Accessor for the vendor attribute of the scanned host
:return: string (vendor) of empty string if no vendor defined
"""
return self._vendor or ''

@property
def ipv6(self):
"""
Expand Down

0 comments on commit 56c7800

Please sign in to comment.