Skip to content

Commit

Permalink
Merge 7be7f59 into d8cdc0a
Browse files Browse the repository at this point in the history
  • Loading branch information
orf committed Sep 11, 2014
2 parents d8cdc0a + 7be7f59 commit 574ad25
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libnmap/objects/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,13 @@ def extraports_state(self):
dictionnary containing state and amount of extra ports scanned
for which a common state, usually, closed was discovered.
:return: dict with keys 'state' and 'count'
:return: dict with keys 'state' and 'count' or None
"""
_xtrports = self._extras['extraports']
_xtrports = self._extras.get('extraports', None)

if _xtrports is None:
return None

return {'state': _xtrports['state'], 'count': _xtrports['count']}

@property
Expand All @@ -445,9 +449,11 @@ def extraports_reasons(self):
dictionnary containing reasons why extra ports scanned
for which a common state, usually, closed was discovered.
:return: array of dict containing keys 'state' and 'count'
:return: array of dict containing keys 'state' and 'count' or None
"""
return self._extras['extraports']['reasons']
r = self._extras.get('extraports', {})

return r.get('reasons', None)

def get_dict(self):
"""
Expand Down

0 comments on commit 574ad25

Please sign in to comment.