Esempio n. 1
0
def find_domains(request):
    ip = request.GET.get('ip', '')
    ip = prepare_ip(ip)

    if ip:

        domains = bing.domains(ip)

        reverse_domain = reverse_dns(ip)
        if reverse_domain:
            domains.append(reverse_domain)

        if domains:
            return JsonResponse({
                'error': 0,
                'list': domains
            })
        else:
            return JsonResponse({
                'error': 1,
                'message': 'Domains not found'
            })

    else:
        return JsonResponse({
            'error': 1,
            'message': 'Invalid IP'
        })
Esempio n. 2
0
def index(request):
    ip = request.GET.get('ip', '')
    ip = prepare_ip(ip)

    context = {'ip': ip if ip else ''}

    return render(request, 'pages/blacklist.html', context)
Esempio n. 3
0
def index(request):
    geo_ip_country = pygeoip.GeoIP(settings.GEOIP_COUNTRY_PATH)
    geo_ip_isp = pygeoip.GeoIP(settings.GEOIP_ISP_PATH)

    input_address = request.GET.get('ip', None)

    if input_address is None:
        ip = get_ip(request)
    else:
        ip = prepare_ip(input_address)

    if ip:
        address = {
            'ip': ip,
            'country': geo_ip_country.country_name_by_addr(ip),
            'isp': geo_ip_isp.isp_by_addr(ip),
            'hostname': reverse_dns(ip),
        }
    else:
        address = {}

    context = {
        'input_address': input_address,
        'address': address,
        'user_agent': get_user_agent(request),
        'language': request.LANGUAGE_CODE
    }

    return render(request, 'pages/home.html', context)
Esempio n. 4
0
def check(request):
    ip = request.GET.get('ip', '')
    ip = prepare_ip(ip)

    if ip:

        status, results = black_list.check(ip)

        context = {'status': status, 'results': results}

        return JsonResponse({
            'error':
            1,
            'message':
            loader.render_to_string('pages/black-list-result.html', context,
                                    request)
        })

    else:
        return JsonResponse({'error': 1, 'message': 'Invalid IP'})