Skip to content

Commit 9112634

Browse files
fix bug single host report PDF
1 parent ed2675c commit 9112634

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

pdf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ def reportPDFView(request):
2222
counters = {'po':0,'pc':0,'pf':0,'hostsup':0,'ostype':{},'pi':{},'ss':{}}
2323

2424
scanmd5 = hashlib.md5(str(request.session['scanfile']).encode('utf-8')).hexdigest()
25-
for i in o['host']:
25+
for ik in o['host']:
26+
27+
# this fix single host report
28+
if type(ik) is dict:
29+
i = ik
30+
else:
31+
i = o['host']
2632

2733
hostcounters = {'po':0,'pc':0,'pf':0,'ostype':{},'pi':{},'ss':{}}
2834
hostdetails_html = ''
@@ -168,6 +174,9 @@ def reportPDFView(request):
168174

169175
portsfound = True
170176

177+
# this fix single host report
178+
if type(ik) is not dict:
179+
break;
171180

172181

173182
notesout,notesb64 = '',''

views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ def details(request, address):
178178
'<td colspan="2" style="color:#999;font-size:12px;">State: '+p['state']['@state']+'<br>Reason: '+p['state']['@reason']+'</td>'+\
179179
'<td><button onclick="javascript:apiPortDetails(\''+html.escape(address)+'\',\''+html.escape(p['@portid'])+'\');" class="btn blue right"><i class="material-icons">receipt</i></button></td></tr>'
180180

181-
# this fix single host report
182-
if type(ik) is not dict:
183-
break;
181+
# this fix single host report
182+
if type(ik) is not dict:
183+
break;
184184

185185
notesout,notesb64,removenotes = '','',''
186186
if scanmd5 in noteshost:

0 commit comments

Comments
 (0)