Skip to content

Commit

Permalink
fix bug on xml with no host up
Browse files Browse the repository at this point in the history
  • Loading branch information
Rev3rseSecurity committed Oct 22, 2018
1 parent ff55324 commit 7294cc2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,24 @@ def index(request, filterservice="", filterportid=""):
r['out2'] = json.dumps(oo['nmaprun'], indent=4)
o = json.loads(r['out2'])

if type(o['host']) is not dict:
hostnum = str(len(o['host']))
if 'host' in o:
if type(o['host']) is not dict:
hostnum = str(len(o['host']))
else:
hostnum = '1'
else:
hostnum = '0'

if hostnum != '0':
viewhref = '/setscanfile/'+html.escape(i)
else:
hostnum = '1'
viewhref = '/" disabled="disabled'

r['trhost'] += '<tr>'+\
' <td style="font-family:monospace">'+html.escape(i)+'</td>'+\
' <td>'+html.escape(o['@startstr'])+'</td>'+\
' <td>'+hostnum+'</td>'+\
' <td><a href="/setscanfile/'+html.escape(i)+'" class="btn blue right">view</a></td>'+\
' <td><a href="'+viewhref+'" class="btn blue right">view</a></td>'+\
'</tr>'

# r['out'] = os.listdir('/opt/xml')
Expand Down

0 comments on commit 7294cc2

Please sign in to comment.