Пример #1
0
def get_context_vt(request, **kwargs):
    filehash = kwargs['pk']
    context = {}
    vt = VT()
    context['vt_hash'] = vt.getFileReport(filehash)
    context['vt_behavior'] = vt.getFileBehavior(filehash)
    return render(request, 'filehash/virustotal.html', context)
Пример #2
0
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['search_form'] = SearchForm()
        url = self.kwargs['pk']

        response = self.getResponse(url)
        if response is not None:
            context['response_code'] = response.status_code
            if "content-type" in response.headers:
                context['content_type'] = response.headers["content-type"]
                context['response_sha256'] = self.getHash(response)
                context['title'] = self.getTitle(response)
            if "last-modified" in response.headers:
                context['last_modified'] = response.headers["last-modified"]
            if "server" in response.headers:
                context['server'] = response.headers["server"]
            if "content-length" in response.headers:
                context['content_length'] = response.headers["content-length"]
        context['imagefile'] = self.getImage(url)
        context['websrc'] = self.getSrc(url)

        try:
            vt = VT()
            context['vt_url'] = vt.getURLReport(url)
        except Exception as e:
            logger.error(e)

        context['bls'] = blacklist.objects.filter(Q(url__contains=url))
        count = context['bls'].count()
        if count > 0:
            context['bls_count'] = count
        context['events'] = Event.objects.filter(
            Q(info__icontains=url)).order_by('-publish_timestamp')
        count = context['events'].count()
        if count > 0:
            context['events_count'] = count
        context['attributes'] = Attribute.objects.filter(
            Q(value__icontains=url)).order_by('-timestamp')
        count = context['attributes'].count()
        if count > 0:
            context['attributes_count'] = count
        context['tws'] = tweet.objects.filter(
            Q(text__icontains=url)).order_by('-datetime')
        count = context['tws'].count()
        if count > 0:
            context['tws_count'] = count
        context['exs'] = Exploit.objects.filter(
            Q(text__icontains=url)).order_by('-datetime')
        count = context['exs'].count()
        if count > 0:
            context['exs_count'] = count

        return context
Пример #3
0
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['search_form'] = SearchForm()
        ip = self.kwargs['pk']

        try:
            context['geoip'] = GeoIP().lookup(ip)
        except Exception as e:
            logger.error(e)

        try:
            context['domain'] = socket.gethostbyaddr(ip)[0]
        except Exception as e:
            logger.error(e)

        try:
            vt = VT()
            context['vt_ip'] = vt.getIPReport(ip)
        except Exception as e:
            logger.error(e)

        try:
            tm = ThreatMiner()
            context['tm_url'] = tm.getURIFromIP(ip)
            context['tm_sample'] = tm.getSamplesFromIP(ip)
            context['tm_report'] = tm.getReportFromIP(ip)
        except Exception as e:
            logger.error(e)

        context['bls'] = blacklist.objects.filter(Q(ip=ip)|Q(url__contains=ip))
        count = context['bls'].count()
        if count > 0:
            context['bls_count'] = count
        context['events'] = Event.objects.filter(Q(info__icontains=ip)).order_by('-publish_timestamp')
        count = context['events'].count()
        if count > 0:
            context['events_count'] = count
        context['attributes'] = Attribute.objects.filter(Q(value__icontains=ip)).order_by('-timestamp')
        count = context['attributes'].count()
        if count > 0:
            context['attributes_count'] = count
        context['tws'] = tweet.objects.filter(Q(text__icontains=ip)).order_by('-datetime')
        count = context['tws'].count()
        if count > 0:
            context['tws_count'] = count
        context['exs'] = Exploit.objects.filter(Q(text__icontains=ip)).order_by('-datetime')
        count = context['exs'].count()
        if count > 0:
            context['exs_count'] = count

        return context
Пример #4
0
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['search_form'] = SearchForm()
        filehash = self.kwargs['pk']

        try:
            vt = VT()
            context['vt_hash'] = vt.getFileReport(filehash)
            context['vt_behavior'] = vt.getFileBehavior(filehash)
        except Exception as e:
            logger.error(e)


#        try:
#            tm = ThreatMiner()
#            context['tm_meta'] = tm.getMetaFromSample(filehash)
#            context['tm_http'] = tm.getHttpFromSample(filehash)
#            context['tm_host'] = tm.getHostsFromSample(filehash)
#            context['tm_av'] = tm.getAVFromSample(filehash)
#            context['tm_report'] = tm.getReportFromSample(filehash)
#        except Exception as e:
#            logger.error(e)

#context['bls'] = blacklist.objects.filter(Q(url__contains=filehash))
#count = context['bls'].count()
#if count > 0:
#    context['bls_count'] = count
        context['events'] = Event.objects.filter(
            Q(info__icontains=filehash)).order_by('-publish_timestamp')
        count = context['events'].count()
        if count > 0:
            context['events_count'] = count
        context['attributes'] = Attribute.objects.filter(
            Q(value__icontains=filehash)).order_by('-timestamp')
        count = context['attributes'].count()
        if count > 0:
            context['attributes_count'] = count
        context['tws'] = tweet.objects.filter(
            Q(text__icontains=filehash)).order_by('-datetime')
        count = context['tws'].count()
        if count > 0:
            context['tws_count'] = count
        context['exs'] = Exploit.objects.filter(
            Q(text__icontains=filehash)).order_by('-datetime')
        count = context['exs'].count()
        if count > 0:
            context['exs_count'] = count

        return context
Пример #5
0
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['search_form'] = SearchForm()
        domain = self.kwargs['pk']
        try:
            context['geoip'] = GeoIP().lookup(domain)
        except Exception as e:
            logger.error(e)
        try:
            context['ipaddress'] = socket.gethostbyname(domain)
        except Exception as e:
            logger.error(e)

        try:
            context['vt_domain'] = VT().getDomainReport(domain)
        except Exception as e:
            logger.error(e)

        context['bls'] = blacklist.objects.filter(Q(domain=domain)|Q(url__contains=domain))
        count = context['bls'].count()
        if count > 0:
            context['bls_count'] = count
        context['events'] = Event.objects.filter(Q(info__icontains=domain)).order_by('-publish_timestamp')
        count = context['events'].count()
        if count > 0:
            context['events_count'] = count
        context['attributes'] = Attribute.objects.filter(Q(value__icontains=domain)).order_by('-timestamp')
        count = context['attributes'].count()
        if count > 0:
            context['attributes_count'] = count
        context['tws'] = tweet.objects.filter(Q(text__icontains=domain)).order_by('-datetime')
        count = context['tws'].count()
        if count > 0:
            context['tws_count'] = count
        context['exs'] = Exploit.objects.filter(Q(text__icontains=domain)).order_by('-datetime')
        count = context['exs'].count()
        if count > 0:
            context['exs_count'] = count

        return context
Пример #6
0
def get_context_vt(request, **kwargs):
    ip = kwargs['pk']
    context = {}
    vt = VT()
    context['vt_ip'] = vt.getIPReport(ip)
    return render(request, 'ip/virustotal.html', context)
Пример #7
0
def get_context_vt(request, **kwargs):
    url = kwargs['pk']
    context = {}
    context['vt_url'] = VT().getURLReport(url)
    return render(request, 'url/virustotal.html', context)
Пример #8
0
def getpcap(request, pk):
    response = HttpResponse(VT().getPcap(pk),
                            content_type="application/vnd.tcpdump.pcap")
    response["Content-Disposition"] = "filename=%s.pcap" % pk
    return response
Пример #9
0
def get_context_vt(request, **kwargs):
    domain = kwargs['pk']
    context = {}
    context['vt_domain'] = VT().getDomainReport(domain)
    return render(request, 'domain/virustotal.html', context)