diff --git a/views.py b/views.py index 21383fa..846f43e 100644 --- a/views.py +++ b/views.py @@ -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'] += ''+\ ' '+html.escape(i)+''+\ ' '+html.escape(o['@startstr'])+''+\ ' '+hostnum+''+\ - ' view'+\ + ' view'+\ '' # r['out'] = os.listdir('/opt/xml')