def campaign_stats(request): """ Generate Campaign stats template. GET Parameters: refresh: Whether or not this is a data refresh (Default: no) campaign: Limit to a specific Campaign (Default: all) :param request: Django request object (Required) :type request: :class:`django.http.HttpRequest` :returns: :class:`django.http.HttpResponse` """ refresh = request.GET.get("refresh", "no") campaign = request.GET.get("campaign", "all") if refresh == "yes": campaign_date_stats() if request.is_ajax(): data_list = get_campaign_stats(campaign) return HttpResponse(json.dumps(data_list, default=json_util.default), content_type="application/json") else: return render_to_response("campaign_monthly.html", {'campaign': campaign}, RequestContext(request))
def campaign_stats(request): """ Generate Campaign stats template. GET Parameters: refresh: Whether or not this is a data refresh (Default: no) campaign: Limit to a specific Campaign (Default: all) :param request: Django request object (Required) :type request: :class:`django.http.HttpRequest` :returns: :class:`django.http.HttpResponse` """ refresh = request.GET.get("refresh", "no") campaign = request.GET.get("campaign", "all") if refresh == "yes": campaign_date_stats() if request.is_ajax(): data_list = get_campaign_stats(campaign) return HttpResponse(json.dumps(data_list, default=json_util.default), mimetype="application/json") else: return render_to_response("campaign_monthly.html", {'campaign': campaign}, RequestContext(request))
def handle(self, *args, **options): """ Script Execution. """ stats.generate_yara_hits() stats.generate_sources() stats.generate_filetypes() stats.generate_campaign_stats() stats.generate_counts() stats.target_user_stats() stats.campaign_date_stats()