Exemplo n.º 1
0
    def get_scan_results(self):
        log.debug(">>> Getting scan results stored in data base")
        u = UmitDB()

        for scan in u.get_scans():
            log.debug(">>> Retrieving result of scans_id %s" % scan.scans_id)
            log.debug(">>> Nmap xml output: %s" % scan.nmap_xml_output)

            temp_file = mktemp(".usr", "umit_")

            tmp = open(temp_file, "w")
            tmp.write(scan.nmap_xml_output)
            tmp.close()

            try:
                parsed = NmapParser()
                parsed.set_xml_file(temp_file)
                parsed.parse()

                # Remove temporary file reference
                parsed.nmap_xml_file = ""
            except:
                pass
            else:
                yield parsed
    def get_scan_results(self):
        log.debug(">>> Getting scan results stored in data base")
        u = UmitDB()

        for scan in u.get_scans():
            log.debug(">>> Retrieving result of scans_id %s" % scan.scans_id)
            log.debug(">>> Nmap xml output: %s" % scan.nmap_xml_output)

            temp_file = mktemp(".usr", "umit_")

            tmp = open(temp_file, "w")
            tmp.write(scan.nmap_xml_output)
            tmp.close()

            try:
                parsed = NmapParser()
                parsed.set_xml_file(temp_file)
                parsed.parse()

                # Remove temporary file reference
                parsed.nmap_xml_file = ""
            except:
                pass
            else:
                yield parsed
Exemplo n.º 3
0
def get_saved_scans(req):
    db = UmitDB()
    data = [{
        "id":
        str(s.scans_id),
        "name":
        str(s.scan_name).replace("'", "\\'"),
        "date":
        datetime.datetime.fromtimestamp(s.date).strftime("%Y-%m-%d %H:%M:%S")
    } for s in db.get_scans()
            if req.POST.get("search", "").lower() in s.scan_name.lower()]
    return HttpResponse(str(data))
Exemplo n.º 4
0
def get_saved_scans(req):
    db = UmitDB()
    data = [
        {
            "id": str(s.scans_id),
            "name": str(s.scan_name).replace("'", "\\'"),
            "date": datetime.datetime.fromtimestamp(s.date).strftime("%Y-%m-%d %H:%M:%S"),
        }
        for s in db.get_scans()
        if req.POST.get("search", "").lower() in s.scan_name.lower()
    ]
    return HttpResponse(str(data))