def burp_scan_launch(request): global vuln_id, burp_status if request.POST.get("url", ): target_url = request.POST.get('url', ) project_id = request.POST.get('project_id', ) scan_id = uuid.uuid4() date_time = datetime.datetime.now() scan_dump = burp_scan_db(scan_id=scan_id, project_id=project_id, url=target_url, date_time=date_time) scan_dump.save() try: do_scan = burp_scans(project_id, target_url, scan_id) do_scan.scan_lauch() except Exception as e: print e return render(request, 'scan_list.html')
def xml_upload(request): all_project = project_db.objects.all() if request.method == "POST": project_id = request.POST.get("project_id") scanner = request.POST.get("scanner") xml_file = request.FILES['xmlfile'] scan_url = request.POST.get("scan_url") scan_id = uuid.uuid4() scan_status = "100" if scanner == "zap_scan": date_time = datetime.datetime.now() scan_dump = zap_scans_db(scan_url=scan_url, scan_scanid=scan_id, date_time=date_time, project_id=project_id, vul_status=scan_status) scan_dump.save() tree = ET.parse(xml_file) root_xml = tree.getroot() zap_xml_parser.xml_parser(project_id=project_id, scan_id=scan_id, root=root_xml) elif scanner == "burp_scan": print scanner print xml_file print scan_url date_time = datetime.datetime.now() scan_dump = burp_scan_db(url=scan_url, scan_id=scan_id, date_time=date_time, project_id=project_id, scan_status=scan_status) scan_dump.save() # Burp scan XML parser tree = ET.parse(xml_file) root_xml = tree.getroot() do_xml_data = burp_scans(project_id, target_url, scan_id) do_xml_data.burp_scan_data(root_xml) print "Save scan Data" return HttpResponseRedirect("/webscanners/burp_scan_list") return render(request, 'upload_xml.html', {'all_project': all_project})