Пример #1
0
def pages(request, time_frame="last_24_hours"):
    all_orgs = ModelQuery.get_all_organizations()
    alerts = ModelQuery.get_alerts_by_timeframe(time_frame)
    template = loader.get_template("dashboard_pages.html")
    context = RequestContext(request, {
        'all_orgs': all_orgs,
        'time_frame': time_frame,
        'alerts': alerts
    })
    return HttpResponse(template.render(context))
Пример #2
0
def alert_export_view(request,time_frame="last_24_hours"):
    response = HttpResponse(content_type="text/csv")
    response['Content-Disposition'] = 'attachment; filename="malspider_alerts.csv"'

    writer = csv.writer(response)
    writer.writerow(['alert_reason', 'source_page','requested_resource','raw_html'])

    alerts = ModelQuery.get_alerts_by_timeframe(time_frame)
    for alert in alerts:
        writer.writerow([unicode(alert.reason).encode("utf-8"),unicode(alert.page).encode("utf-8"), unicode(alert.uri).encode("utf-8"), unicode(alert.raw).encode("utf-8")])

    return response
Пример #3
0
def alert_export_view(request, time_frame="last_24_hours"):
    response = HttpResponse(content_type="text/csv")
    response[
        'Content-Disposition'] = 'attachment; filename="malspider_alerts.csv"'

    writer = csv.writer(response)
    writer.writerow(
        ['alert_reason', 'source_page', 'requested_resource', 'raw_html'])

    alerts = ModelQuery.get_alerts_by_timeframe(time_frame)
    for alert in alerts:
        writer.writerow([
            unicode(alert.reason).encode("utf-8"),
            unicode(alert.page).encode("utf-8"),
            unicode(alert.uri).encode("utf-8"),
            unicode(alert.raw).encode("utf-8")
        ])

    return response
Пример #4
0
def pages(request, time_frame="last_24_hours"):
    all_orgs = ModelQuery.get_all_organizations()
    alerts = ModelQuery.get_alerts_by_timeframe(time_frame)
    template = loader.get_template("dashboard_pages.html")
    context = RequestContext(request, {'all_orgs':all_orgs, 'time_frame':time_frame, 'alerts':alerts})
    return HttpResponse(template.render(context))