use of com.xebia.vulnmanager.models.nmap.objects.GeneralScanResult in project vulnmanager by xebia-research.
the class ScanDataParserHelper method getGeneralScanResults.
private GeneralScanResult getGeneralScanResults(NodeList runStatistics) {
String numberOfScannedHosts = null, numberOfHostUp = null, numberOfHostDown = null, timeElapsed = null;
for (int x = 0; x < runStatistics.getLength(); x++) {
Node currentStatisticNode = runStatistics.item(x);
String statisticName = currentStatisticNode.getNodeName();
if (statisticName.equals(NMapConstants.PARSER_LITERAL_NMAP_HOSTS)) {
numberOfScannedHosts = currentStatisticNode.getAttributes().getNamedItem(NMapConstants.PARSER_LITERAL_NMAP_TOTAL).getNodeValue();
numberOfHostUp = currentStatisticNode.getAttributes().getNamedItem(NMapConstants.PARSER_LITERAL_NMAP_UP).getNodeValue();
numberOfHostDown = currentStatisticNode.getAttributes().getNamedItem(NMapConstants.PARSER_LITERAL_NMAP_DOWN).getNodeValue();
} else if (statisticName.equals(NMapConstants.PARSER_LITERAL_NMAP_FINISHED)) {
timeElapsed = currentStatisticNode.getAttributes().getNamedItem(NMapConstants.PARSER_LITERAL_NMAP_ELAPSED).getNodeValue();
}
}
return new GeneralScanResult(numberOfScannedHosts, numberOfHostUp, numberOfHostDown, timeElapsed);
}
use of com.xebia.vulnmanager.models.nmap.objects.GeneralScanResult in project vulnmanager by xebia-research.
the class ScanDataParserHelper method getReportData.
NMapGeneralInformation getReportData(Document nMapDoc) {
NamedNodeMap reportData = nMapDoc.getElementsByTagName(NMapConstants.PARSER_LITERAL_NMAP_RUN).item(0).getAttributes();
NMapInfo nMapInfo = getNMapInfo(reportData);
NamedNodeMap scanInfo = nMapDoc.getElementsByTagName(NMapConstants.PARSER_LITERAL_NMAP_SCAN_INFO).item(0).getAttributes();
NodeList tasksList = nMapDoc.getElementsByTagName(NMapConstants.PARSER_LITERAL_NMAP_TASK_END);
NMapScanInfo nMapScanInfo = getNMapScanInfo(scanInfo, tasksList);
NodeList runStatistics = nMapDoc.getElementsByTagName(NMapConstants.PARSER_LITERAL_NMAP_RUNSTATS).item(0).getChildNodes();
GeneralScanResult generalScanResult = getGeneralScanResults(runStatistics);
return new NMapGeneralInformation(nMapInfo, nMapScanInfo, generalScanResult);
}
Aggregations