def export(request): """ :param request: :return: """ username = request.user.username if request.method == 'POST': scan_id = request.POST.get("scan_id") report_type = request.POST.get("type") scan_item = str(scan_id) value = scan_item.replace(" ", "") value_split = value.split(',') zap_resource = BurpResource() queryset = burp_scan_result_db.objects.filter(username=username, scan_id__in=value_split) dataset = zap_resource.export(queryset) if report_type == 'csv': response = HttpResponse(dataset.csv, content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="%s.csv"' % 'burp_results' return response if report_type == 'json': response = HttpResponse(dataset.json, content_type='application/json') response['Content-Disposition'] = 'attachment; filename="%s.json"' % 'burp_results' return response if report_type == 'yaml': response = HttpResponse(dataset.yaml, content_type='application/x-yaml') response['Content-Disposition'] = 'attachment; filename="%s.yaml"' % 'burp_results' return response
def export(request): """ :param request: :return: """ if request.method == 'POST': scan_id = request.POST.get("scan_id") report_type = request.POST.get("type") zap_resource = BurpResource() queryset = burp_scan_result_db.objects.filter(scan_id=scan_id) dataset = zap_resource.export(queryset) if report_type == 'csv': response = HttpResponse(dataset.csv, content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="%s.csv"' % scan_id return response if report_type == 'json': response = HttpResponse(dataset.json, content_type='application/json') response['Content-Disposition'] = 'attachment; filename="%s.json"' % scan_id return response if report_type == 'yaml': response = HttpResponse(dataset.yaml, content_type='application/x-yaml') response['Content-Disposition'] = 'attachment; filename="%s.yaml"' % scan_id return response
def export(request): """ :param request: :return: """ if request.method == "POST": scan_id = request.POST.get("scan_id") report_type = request.POST.get("type") scan_item = str(scan_id) value = scan_item.replace(" ", "") value_split = value.split(",") zap_resource = BurpResource() queryset = WebScanResultsDb.objects.filter(scanner="Burp", scan_id__in=value_split) dataset = zap_resource.export(queryset) if report_type == "csv": response = HttpResponse(dataset.csv, content_type="text/csv") response["Content-Disposition"] = ( 'attachment; filename="%s.csv"' % "burp_results") return response if report_type == "json": response = HttpResponse(dataset.json, content_type="application/json") response["Content-Disposition"] = ( 'attachment; filename="%s.json"' % "burp_results") return response if report_type == "yaml": response = HttpResponse(dataset.yaml, content_type="application/x-yaml") response["Content-Disposition"] = ( 'attachment; filename="%s.yaml"' % "burp_results") return response