use of com.xebia.vulnmanager.models.nmap.objects.NMapReport in project vulnmanager by xebia-research.
the class NMapController method getNMapReport.
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseBody
ResponseEntity<?> getNMapReport(@ModelAttribute("isAuthenticated") boolean isAuthenticated) {
if (!isAuthenticated) {
return new ResponseEntity(new ErrorMsg("Auth not correct!"), HttpStatus.BAD_REQUEST);
}
Object parsedDocument = ReportUtil.parseDocument(ReportUtil.getDocumentFromFile(new File("example_logs/nmap.xml")));
NMapReport report = getNMapReportFromObject(parsedDocument);
if (report == null) {
return new ResponseEntity<>(new ErrorMsg("The file requested is not of the right type"), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity<>(report, HttpStatus.OK);
}
use of com.xebia.vulnmanager.models.nmap.objects.NMapReport in project vulnmanager by xebia-research.
the class NMapParser method getNMapReport.
public NMapReport getNMapReport(Document nMapDoc) {
ScanDataParserHelper scanDataParserHelper = new ScanDataParserHelper();
HostsParserHelper hostsParserHelper = new HostsParserHelper();
NMapGeneralInformation nMapScanData = scanDataParserHelper.getReportData(nMapDoc);
List<Host> hosts = hostsParserHelper.getHostsFromDocument(nMapDoc);
return new NMapReport(nMapScanData, hosts);
}
Aggregations