def pdfify(enhanced, output): enhanced["scan"]["time"] = fromEpoch(enhanced["scan"]["time"]) enhanced["enhanced"]["time"] = fromEpoch(enhanced["enhanced"]["time"]) appendixes=[] appendix = 1 for system in enhanced["systems"]: if "cpes" in system: for cpe in system["cpes"]: cpe["cpe"] = toHuman(cpe["cpe"]) if "cves" in cpe and len(cpe["cves"])!=0: appendixes.append(cpe["cves"]) cpe.pop("cves") cpe["appendix"]=appendix appendix += 1 for service in system["services"]: service["banner"]=product(service["banner"]) if "cves" in service and len(service["cves"])!=0: appendixes.append(service["cves"]) service["appendix"] = appendix appendix += 1 if "cves" in service: service.pop("cves") enhanced["appendixes"]=appendixes html_out = template.render(enhanced) HTML(string=html_out).write_pdf(output, stylesheets=[stylesheets])
def pdfify(enhanced, output): enhanced["scan"]["time"] = fromEpoch(enhanced["scan"]["time"]) enhanced["enhanced"]["time"] = fromEpoch(enhanced["enhanced"]["time"]) appendixes = [] appendix = 1 for system in enhanced["systems"]: if "cpes" in system: for cpe in system["cpes"]: cpe["cpe"] = toHuman(cpe["cpe"]) if "cves" in cpe and len(cpe["cves"]) != 0: appendixes.append(cpe["cves"]) cpe.pop("cves") cpe["appendix"] = appendix appendix += 1 for service in system["services"]: service["banner"] = product(service["banner"]) if "cves" in service and len(service["cves"]) != 0: appendixes.append(service["cves"]) service["appendix"] = appendix appendix += 1 if "cves" in service: service.pop("cves") enhanced["appendixes"] = appendixes html_out = template.render(enhanced) HTML(string=html_out).write_pdf(output, stylesheets=[stylesheets])
def humanify(cpe): return toHuman(cpe)