Search in sources :

Example 1 with NMapReport

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);
}
Also used : NMapReport(com.xebia.vulnmanager.models.nmap.objects.NMapReport) ResponseEntity(org.springframework.http.ResponseEntity) ErrorMsg(com.xebia.vulnmanager.models.net.ErrorMsg) File(java.io.File)

Example 2 with NMapReport

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);
}
Also used : NMapReport(com.xebia.vulnmanager.models.nmap.objects.NMapReport) NMapGeneralInformation(com.xebia.vulnmanager.models.nmap.objects.NMapGeneralInformation) Host(com.xebia.vulnmanager.models.nmap.objects.Host)

Aggregations

NMapReport (com.xebia.vulnmanager.models.nmap.objects.NMapReport)2 ErrorMsg (com.xebia.vulnmanager.models.net.ErrorMsg)1 Host (com.xebia.vulnmanager.models.nmap.objects.Host)1 NMapGeneralInformation (com.xebia.vulnmanager.models.nmap.objects.NMapGeneralInformation)1 File (java.io.File)1 ResponseEntity (org.springframework.http.ResponseEntity)1