예제 #1
0
def sub_domain_search(request):
    """

    :param request:
    :return:
    """
    mylist = ['http://', 'https://']

    if request.method == 'GET':
        domain = request.GET['domain']
        global all_domain
        all_domain = osint_domain_db.objects.filter(domains=domain)

    if request.method == 'POST':
        domain = request.POST.get('domain')
        project_id = request.POST.get('project_id')

        subdomains = sublist3r.main(domain,
                                    False,
                                    'subdomains.txt',
                                    ports=None,
                                    silent=False,
                                    verbose=False,
                                    enable_bruteforce=False,
                                    engines=None)
        for sdomain in subdomains:
            print sdomain
            for a in mylist:
                try:
                    # r = requests.get(a + sdomain)
                    print "sasdfasdfasdf", a + sdomain
                    r = requests.head(a + sdomain, allow_redirects=False)
                    print "status code", r.status_code
                    if r.status_code == 200:
                        final_url = a + sdomain
                        print "final url", final_url
                        save_subdoamin = osint_domain_db(domains=domain,
                                                         sub_domains=final_url,
                                                         project_id=project_id)
                        save_subdoamin.save()

                except:
                    print "error as in subdomain"
        return HttpResponseRedirect('/osintscan/domain_list/')

    return render(request, 'sub_domains.html', {'all_domain': all_domain})
예제 #2
0
def sub_domain_search(request):
    """

    :param request:
    :return:
    """
    mylist = ['http://', 'https://']

    if request.method == 'GET':
        domain = request.GET['domain']
        global all_domain
        all_domain = osint_domain_db.objects.filter(domains=domain)

    if request.method == 'POST':
        domain = request.POST.get('domain')
        project_id = request.POST.get('project_id')

        subdomains = sublist3r.main(domain, False, 'subdomains.txt', ports=None, silent=False,
                                    verbose=False, enable_bruteforce=False, engines=None)
        for sdomain in subdomains:
            print sdomain
            for a in mylist:
                try:
                    # r = requests.get(a + sdomain)
                    print "sasdfasdfasdf", a + sdomain
                    r = requests.head(a + sdomain, allow_redirects=False)
                    print "status code", r.status_code
                    if r.status_code == 200:
                        final_url = a + sdomain
                        print "final url", final_url
                        save_subdoamin = osint_domain_db(domains=domain,
                                                         sub_domains=final_url,
                                                         project_id=project_id)
                        save_subdoamin.save()

                except:
                    print "error as in subdomain"
        return HttpResponseRedirect('/osintscan/domain_list/')

    return render(request, 'sub_domains.html', {'all_domain': all_domain})