示例#1
0
def osint_whois(request):
    """

    :param request:
    :return:
    """
    domain_z = ''
    if request.method == "POST":
        domain = request.POST.get('domain')
        print domain

        domain_item = str(domain)
        value = domain_item.replace(" ", "")
        value_split = value.split(',')
        split_length = value_split.__len__()
        for i in range(0, split_length):
            domain_s = value_split.__getitem__(i)
            print domain_s
            all_whois_info = osint_whois_db.objects.filter(domain=domain)
            for a in all_whois_info:
                domain_z = a.domain
            print "aaaa", domain_z
            if domain_s == domain_z:
                print "Domain Already Existed", domain
                return HttpResponseRedirect('/osintscan/domain_list/')
            else:
                whois_info = whois.whois(domain_s)
                for key, value in whois_info.viewitems():
                    global updated_date
                    if key == 'updated_date':
                        updated_date = value
                    global status
                    if key == 'status':
                        status = value
                    global name
                    if key == 'name':
                        name = value
                    global city
                    if key == 'city':
                        city = value
                    global expiration_date
                    if key == 'expiration_date':
                        expiration_date = value
                    global zipcode
                    if key == 'zipcode':
                        zipcode = value
                    global domain_name
                    if key == 'domain_name':
                        domain_name = value
                    global country
                    if key == 'country':
                        country = value
                    global whois_server
                    if key == 'whois_server':
                        whois_server = value
                    global state
                    if key == 'state':
                        state = value
                    global registrar
                    if key == 'registrar':
                        registrar = value
                    global referral_url
                    if key == 'referral_url':
                        referral_url = value
                    global address
                    if key == 'address':
                        address = value
                    global name_servers
                    if key == 'name_servers':
                        ns = ("</p>".join(map(str, value)))
                        name_servers = ns
                    global org
                    if key == 'org':
                        org = value
                    global creation_date
                    if key == 'creation_date':
                        creation_date = value
                    global emails
                    if key == 'emails':
                        email = ("</p>".join(map(str, value)))
                        emails = email

                dump_all_whois = osint_whois_db(
                    domain=domain,
                    updated_date=updated_date,
                    status=status,
                    name=name,
                    city=city,
                    expiration_date=expiration_date,
                    zipcode=zipcode,
                    domain_name=domain_name,
                    country=country,
                    whois_server=whois_server,
                    state=state,
                    registrar=registrar,
                    referral_url=referral_url,
                    address=address,
                    name_servers=name_servers,
                    org=org,
                    creation_date=creation_date,
                    emails=emails)
                dump_all_whois.save()

    return HttpResponseRedirect('/osintscan/domain_list/')
示例#2
0
def osint_whois(request):
    """

    :param request:
    :return:
    """
    domain_z = ''
    if request.method == "POST":
        domain = request.POST.get('domain')
        print domain

        domain_item = str(domain)
        value = domain_item.replace(" ", "")
        value_split = value.split(',')
        split_length = value_split.__len__()
        for i in range(0, split_length):
            domain_s = value_split.__getitem__(i)
            print domain_s
            all_whois_info = osint_whois_db.objects.filter(domain=domain)
            for a in all_whois_info:
                domain_z = a.domain
            print "aaaa", domain_z
            if domain_s == domain_z:
                print "Domain Already Existed", domain
                return HttpResponseRedirect('/osintscan/domain_list/')
            else:
                whois_info = whois.whois(domain_s)
                for key, value in whois_info.viewitems():
                    global updated_date
                    if key == 'updated_date':
                        updated_date = value
                    global status
                    if key == 'status':
                        status = value
                    global name
                    if key == 'name':
                        name = value
                    global city
                    if key == 'city':
                        city = value
                    global expiration_date
                    if key == 'expiration_date':
                        expiration_date = value
                    global zipcode
                    if key == 'zipcode':
                        zipcode = value
                    global domain_name
                    if key == 'domain_name':
                        domain_name = value
                    global country
                    if key == 'country':
                        country = value
                    global whois_server
                    if key == 'whois_server':
                        whois_server = value
                    global state
                    if key == 'state':
                        state = value
                    global registrar
                    if key == 'registrar':
                        registrar = value
                    global referral_url
                    if key == 'referral_url':
                        referral_url = value
                    global address
                    if key == 'address':
                        address = value
                    global name_servers
                    if key == 'name_servers':
                        ns = ("</p>".join(map(str, value)))
                        name_servers = ns
                    global org
                    if key == 'org':
                        org = value
                    global creation_date
                    if key == 'creation_date':
                        creation_date = value
                    global emails
                    if key == 'emails':
                        email = ("</p>".join(map(str, value)))
                        emails = email

                dump_all_whois = osint_whois_db(domain=domain,
                                                updated_date=updated_date,
                                                status=status,
                                                name=name,
                                                city=city,
                                                expiration_date=expiration_date,
                                                zipcode=zipcode,
                                                domain_name=domain_name,
                                                country=country,
                                                whois_server=whois_server,
                                                state=state,
                                                registrar=registrar,
                                                referral_url=referral_url,
                                                address=address,
                                                name_servers=name_servers,
                                                org=org,
                                                creation_date=creation_date,
                                                emails=emails
                                                )
                dump_all_whois.save()

    return HttpResponseRedirect('/osintscan/domain_list/')