Skip to content

Commit

Permalink
fix number of xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
theMiddleBlue committed Oct 25, 2018
1 parent b6d7b36 commit 4e7259a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,17 @@ def index(request, filterservice="", filterportid=""):
' </div>'+\
'</div>'

r['scaninfo'] = '<span class="card-title">Select a Nmap XML file</span><p>Nmap XML files: '+ str(len(xmlfiles)) +'</p>'

r['trhost'] = ''
r['trhead'] = '<tr><th>Filename</th><th>Scan Start Time</th><th>Hosts</th><th>&nbsp;</th></tr>'

xmlfilescount = 0
for i in xmlfiles:
if re.search('\.xml$', i) is None:
continue

xmlfilescount = (xmlfilescount + 1)

oo = xmltodict.parse(open('/opt/xml/'+i, 'r').read())
r['out2'] = json.dumps(oo['nmaprun'], indent=4)
o = json.loads(r['out2'])
Expand All @@ -327,7 +330,8 @@ def index(request, filterservice="", filterportid=""):
' <td><a href="'+viewhref+'" class="btn blue right">view</a></td>'+\
'</tr>'

# r['out'] = os.listdir('/opt/xml')
r['scaninfo'] = '<span class="card-title">Select a Nmap XML file</span><p>Nmap XML files: '+ str(xmlfilescount) +'</p>'

return render(request, 'nmapreport/index.html', r)

scanmd5 = hashlib.md5(str(request.session['scanfile']).encode('utf-8')).hexdigest()
Expand Down

0 comments on commit 4e7259a

Please sign in to comment.