Secunia CSI7
Advisories
Research
Forums
Create Profile
Our Commitment
PSI
PSI API
CSI
OSI
xSI
Vulnerabilities
Programs
Open Discussions
My Threads
Create Thread
Statistics
About

Forum Thread: example html to view psi api output

You are currently viewing a forum thread in the Secunia Community Forum. Please note that opinions expressed here are not of Secunia but solely reflect those of the user who wrote it.

This thread was submitted in the following forum:
PSI API

This thread has been marked as locked.
boardtrak23 example html to view psi api output
Member 19th May, 2011 04:20
Ranking: 0
Posts: 5
User Since: 18th May, 2011
System Score: N/A
Location: US
I moved this post here from my accidental post to CSI thread

I haven't seen many examples of actually displaying PSI API output, so i will attempt to post a simple one below. I will post raw html below and see how it turns out. You will have to obtain a xml output file from your API results token and put that file in same dir.
1. Save everything below this cut line as psi_test.html
2. Download a results type of psi api output xml and save as mypc.xml in same dir.
3. Open psi_test.html in a browser that allows javascript. (js parses the xml file).
Security implications of this are that the xml and html must be on same host, a Javascript required security caveat.
edit:(Looks like there are issues posting this code to this forum, any line over 54? characters
ends up with a space where you don't want it. User can fix this by loading up the .html file and looking for spaces in the 55th column or so that should not be there.)

********cut below and save as psi_test.html*****************

<html>
<head>
</head>


<body>



<script type="text/javascript">

if (window.XMLHttpRequest)

{// code for IE7+, Firefox, Chrome, Opera, Safari

xmlhttp=new XMLHttpRequest();

}

else

{// code for IE6, IE5

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

}

xmlhttp.open("GET","mypc.xml",false);

xmlhttp.send();

xmlDoc=xmlhttp.responseXML;



document.write("<table border='1'>");



document.write("<tr><td>");

document.write("lastFullScan");

document.write("</td><td>");

document.write("numInsecure");

document.write("</td><td>");

document.write("numEOL");

document.write("</td><td>");

document.write("numPatched");

document.write("</td><td>");

document.write("numTotal");

document.write("</td><td>");

document.write("secuniaSystemScore");

document.write("</td><td>");

document.write("numTotal");

document.write("</td></tr>");



var x=xmlDoc.getElementsByTagName("systemOverview");

for (i=0;i<x.length;i++)

{

document.write("<tr><td>");

var secs=
Number(x[i].getElementsByTagName("lastFullScan")[0 ].childNodes[0].nodeValue);

var d = new Date(secs * 1000);

document.write((1+d.getMonth()) + "/" + d.getDate() + "/" + d.getFullYear());

document.write("</td><td>");

document.write(x[i].getElementsByTagName("numInsec ure")[0].childNodes[0].nodeValue);

document.write("</td><td>");

document.write(x[i].getElementsByTagName("numEOL") [0].childNodes[0].nodeValue);

document.write("</td><td>");

document.write(x[i].getElementsByTagName("numPatch ed")[0].childNodes[0].nodeValue);

document.write("</td><td>");

document.write(x[i].getElementsByTagName("numTotal ")[0].childNodes[0].nodeValue);

document.write("</td><td>");

document.write(x[i].getElementsByTagName("secuniaS ystemScore")[0].childNodes[0].nodeValue);

document.write("</td><td>");

document.write(x[i].getElementsByTagName("numTotal ")[0].childNodes[0].nodeValue);

document.write("</td></tr>");

}

document.write("</table>");

</script>



</body>

</html>





No one has replied to this thread yet - be the first
This thread has been marked as locked.


 Products Solutions Customers Partner Resources Company
 
 Corporate
Vulnerability Intelligence Manager (VIM)
Corporate Software Inspector (CSI)
Consumer
Personal Software Inspector (PSI)
Online Software Inspector (OSI)
 Industry
Compliance
Technology
Integration
 Customers
Testimonials
 VARS
MSSP
Technology Partners
References
 Reports
Webinars
Events
 About us
Careers
Memberships
Newsroom


 
© 2002-2014 Secunia ApS - Rued Langgaards Vej 8, 4th floor, DK-2300 Copenhagen, Denmark - +45 7020 5144
Terms & Conditions and Copyright - Privacy - Report Vulnerability