Esempio n. 1
0
def action_netcraft(domain, myResolver):
    netcraft_list = []
    print "\nPassive Gatherings From NetCraft\n"
    try:
        link = "http://searchdns.netcraft.com/?restriction=site+contains&host=*.{}&lookup=wait..&position=limited".format(
            domain)
        response = requests.get(link)
        soup = BeautifulSoup(response.content, 'lxml')
        pattern = 'rel="nofollow">([a-z\.\-A-Z0-9]+)<FONT COLOR="#ff0000">'
        sub_results = re.findall(pattern, response.content)

    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details\n'
        warning(traceback.print_exc())

    if sub_results:
        for item in sub_results:
            netcheck = myResolver.query(item + '.' + domain)
            for data in netcheck:
                netcraft_list.append(item + '.' + domain + ' ' + str(data))
                print colored(item + '.' + domain, 'red')
    else:
        print '\tNo Results Found'

    return netcraft_list
Esempio n. 2
0
def action_zone_transfer(zn_list, domain):
    global clean_dump
    print "\nAttempting Zone Transfers"
    zn_list.sort()
    vuln = True
    vulnerable_listT = []
    vulnerable_listF = []
    dump_list = []
    for ns in zn_list:
        try:
            z = dns.zone.from_xfr(dns.query.xfr(ns, domain))
            names = z.nodes.keys()
            names.sort()
            if vuln == True:
                vulnerable_listT.append(ns)

        except Exception as e:
            error = str(e)
            if error == 'Errno -2] Name or service not known':
                pass
            if error == "[Errno 54] Connection reset by peer" or "No answer or RRset not for qname":
                vuln = False
                vulnerable_listF.append(ns)
            else:
                print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
                warning(traceback.print_exc())

    if vulnerable_listF:
        print "\nNot Vulnerable:\n"
        for ns in vulnerable_listF:
            print colored(ns, 'green')

    if vulnerable_listT:
        print "\nVulnerable:\n"
        for ns in vulnerable_listT:
            print colored(ns, 'red'), colored("\t" + "TCP/53", 'red')

        z = dns.zone.from_xfr(dns.query.xfr(vulnerable_listT[0], domain))
        names = z.nodes.keys()
        names.sort()
        print "\nRaw Zone Dump\n"
        for n in names:
            data1 = "{}.{}".format(n, domain)
            try:
                addr = socket.gethostbyname(data1)
                dump_list.append("{}.{} {}".format(n, domain, addr))

            except Exception as e:
                error = str(e)
                if error == "[Errno -5] No address associated with hostname":
                    pass
                if error == 'Errno -2] Name or service not known':
                    pass
                else:
                    print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
                    warning(traceback.print_exc())
            print z[n].to_text(n)

    clean_dump = sorted(set(dump_list))
    return ((vulnerable_listT, clean_dump))
Esempio n. 3
0
def action_pwned(emails):
    pwend_data = []
    seen = set()
    for email in emails:
        link = 'https://haveibeenpwned.com/api/v2/breachedaccount/{}'.format(email)
        try:
            headers = {"Connection" : "close",
                       "User-Agent" : "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
                       'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                       'Accept-Language': 'en-US,en;q=0.5',
                       'Accept-Encoding': 'gzip, deflate'}

            response = requests.get(link, headers=headers)
            json_data = response.json()
            if json_data:
                if email in seen:
                    pass
                else:
                    for item in json_data:
                        seen.add(email)
                        email_address = email
                        breach_domain = str(item['Domain']).replace("u'","")
                        breach_data = str(item['DataClasses']).replace("u'","'").replace('"','').replace('[','').replace(']','')
                        breach_date = str(item['BreachDate']).replace("u'","")
                        breach_added = str(item['AddedDate']).replace("u'","").replace('T',' ').replace('Z','')
                        breach_description = str(item['Description']).replace("u'","")
                        pwend_data.append((email_address, breach_domain, breach_data, breach_date, breach_added, breach_description))

        except ValueError:
            pass
        except Exception:
            print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
            warning(traceback.print_exc())

    return pwend_data
Esempio n. 4
0
def action_emailHunter(domain, api, useragent_f, q, prox):
    emails = []
    uas = get_user_agents(useragent_f)
    ua = random.choice(uas)
    link = 'https://api.emailhunter.co/v1/search?domain={0}&api_key={1}'.format(domain,api)

    if prox == True:
                proxy = {'http' : 'http://127.0.0.1:8080'}
    else:
        pass
    try:
        headers = {"Connection" : "close",
                   "User-Agent" : ua,
                   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                   'Accept-Language': 'en-US,en;q=0.5',
                   'Accept-Encoding': 'gzip, deflate'}
        if prox == True:
            response = requests.get(link, headers=headers, proxies=proxy)
        else:
            response = requests.get(link, headers=headers)

        json_data = response.json()
        for value in json_data['emails']:
            for domain in value['sources']:
                url = str(domain['uri']).replace("u'","")
                email =  str(value['value']).replace("u'","")
                emails.append((email,url))
    except ValueError:
        pass
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())

    q.put(sorted(emails))
Esempio n. 5
0
def action_bluto_use(countryID):
    now = datetime.datetime.now()
    try:
        link = "http://darryllane.co.uk/bluto/log_use.php"
        payload = {'country': countryID, 'Date': now}
        requests.post(link, data=payload)
    except Exception:
        warning(traceback.print_exc())
        pass
Esempio n. 6
0
def action_bluto_use(countryID):
    now = datetime.datetime.now()
    try:
        link = "http://darryllane.co.uk/bluto/log_use.php"
        payload = {'country': countryID, 'Date': now}
        requests.post(link, data=payload)
    except Exception:
        warning(traceback.print_exc())
        pass
Esempio n. 7
0
def get_subs(filename, domain):
    full_list = []
    try:
        subs = [line.rstrip('\n') for line in open(filename)]
        for sub in subs:
            full_list.append(str(sub.lower() + "." + domain))
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details\n'
        warning(traceback.print_exc())
        sys.exit()

    return full_list
Esempio n. 8
0
def get_subs(filename, domain):
    full_list = []
    try:
        subs = [line.rstrip('\n') for line in open(filename)]
        for sub in subs:
            full_list.append(str(sub.lower() + "." + domain))
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details\n'
        warning(traceback.print_exc())
        sys.exit()

    return full_list
Esempio n. 9
0
def check_dom(domain):
    try:
        myAnswers = myResolver.query(domain, "NS")
        dom = str(myAnswers.canonical_name).strip('.')
        if dom:
            pass
    except dns.resolver.NXDOMAIN:
        print '\nError: \nDomain Not Valid, Check You Have Entered It Correctly\n'
        sys.exit()
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())
Esempio n. 10
0
def check_dom(domain):
    try:
        myAnswers = myResolver.query(domain, "NS")
        dom = str(myAnswers.canonical_name).strip('.')
        if dom:
            pass
    except dns.resolver.NXDOMAIN:
        print '\nError: \nDomain Not Valid, Check You Have Entered It Correctly\n'
        sys.exit()
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())
Esempio n. 11
0
def get_dns_details(domain, myResolver):
    ns_list = []
    zn_list = []
    mx_list = []
    try:
        print "\nName Server:\n"
        myAnswers = myResolver.query(domain, "NS")
        for data in myAnswers.rrset:
            data1 = str(data)
            data2 = (data1.rstrip('.'))
            addr = socket.gethostbyname(data2)
            ns_list.append(data2 + '\t' + addr)
            zn_list.append(data2)
            list(set(ns_list))
            ns_list.sort()
        for i in ns_list:
            print colored(i, 'green')
    except dns.resolver.NoAnswer:
        print "\tNo DNS Servers"
    except dns.resolver.NXDOMAIN:
        print "\tDomain Does Not Exist"
        e = str(sys.exc_info()[0])
    except dns.resolver.Timeout:
        print '\tTimeouted\nConfirm The Domain Name Is Correct.'
        sys.exit()
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())

    try:
        print "\nMail Server:\n"
        myAnswers = myResolver.query(domain, "MX")
        for data in myAnswers:
            data1 = str(data)
            data2 = (data1.split(' ', 1)[1].rstrip('.'))
            addr = socket.gethostbyname(data2)
            mx_list.append(data2 + '\t' + addr)
            list(set(mx_list))
            mx_list.sort()
        for i in mx_list:
            print colored(i, 'green')
    except dns.resolver.NoAnswer:
        print "\tNo Mail Servers"
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())

    return zn_list
Esempio n. 12
0
def action_pwned(emails):
    pwend_data = []
    seen = set()
    for email in emails:
        link = 'https://haveibeenpwned.com/api/v2/breachedaccount/{}'.format(
            email)
        try:
            headers = {
                "Connection": "close",
                "User-Agent":
                "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
                'Accept':
                'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                'Accept-Language': 'en-US,en;q=0.5',
                'Accept-Encoding': 'gzip, deflate'
            }

            response = requests.get(link, headers=headers)
            json_data = response.json()
            if json_data:
                if email in seen:
                    pass
                else:
                    for item in json_data:
                        seen.add(email)
                        email_address = email
                        breach_domain = str(item['Domain']).replace("u'", "")
                        breach_data = str(item['DataClasses']).replace(
                            "u'",
                            "'").replace('"', '').replace('[',
                                                          '').replace(']', '')
                        breach_date = str(item['BreachDate']).replace("u'", "")
                        breach_added = str(item['AddedDate']).replace(
                            "u'", "").replace('T', ' ').replace('Z', '')
                        breach_description = str(item['Description']).replace(
                            "u'", "")
                        pwend_data.append(
                            (email_address, breach_domain, breach_data,
                             breach_date, breach_added, breach_description))

        except ValueError:
            pass
        except Exception:
            print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
            warning(traceback.print_exc())

    return pwend_data
Esempio n. 13
0
def action_brute(subdomain):
    try:
        myAnswers = myResolver.query(subdomain)
        for data in myAnswers:
            targets.append(subdomain + ' ' + str(data))

    except dns.resolver.NoNameservers:
        pass
    except dns.resolver.NXDOMAIN:
        pass
    except dns.resolver.NoAnswer:
        pass
    except dns.exception.SyntaxError:
        pass
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())
Esempio n. 14
0
def action_emailHunter(domain, api, useragent_f, q, prox):
    emails = []
    uas = get_user_agents(useragent_f)
    ua = random.choice(uas)
    link = 'https://api.emailhunter.co/v1/search?domain={0}&api_key={1}'.format(
        domain, api)

    if prox == True:
        proxy = {'http': 'http://127.0.0.1:8080'}
    else:
        pass
    try:
        headers = {
            "Connection": "close",
            "User-Agent": ua,
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Language': 'en-US,en;q=0.5',
            'Accept-Encoding': 'gzip, deflate'
        }
        if prox == True:
            response = requests.get(link, headers=headers, proxies=proxy)
        else:
            response = requests.get(link, headers=headers)

        json_data = response.json()
        for value in json_data['emails']:
            for domain in value['sources']:
                url = str(domain['uri']).replace("u'", "")
                email = str(value['value']).replace("u'", "")
                emails.append((email, url))
    except ValueError:
        pass
    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
        warning(traceback.print_exc())

    q.put(sorted(emails))
Esempio n. 15
0
def action_netcraft(domain, myResolver):
    netcraft_list = []
    print "\nPassive Gatherings From NetCraft\n"
    try:
        link = "http://searchdns.netcraft.com/?restriction=site+contains&host=*.{}&lookup=wait..&position=limited" .format (domain)
        response = requests.get(link)
        soup = BeautifulSoup(response.content, 'lxml')
        pattern = 'rel="nofollow">([a-z\.\-A-Z0-9]+)<FONT COLOR="#ff0000">'
        sub_results = re.findall(pattern, response.content)

    except Exception:
        print 'An Unhandled Exception Has Occured, Please Check The Log For Details\n'
        warning(traceback.print_exc())

    if sub_results:
        for item in sub_results:
            netcheck = myResolver.query(item + '.' + domain)
            for data in netcheck:
                netcraft_list.append(item + '.' + domain + ' ' + str(data))
                print colored(item + '.' + domain, 'red')
    else:
        print '\tNo Results Found'

    return netcraft_list
Esempio n. 16
0
                        pass
            time.sleep(3)
            for urls in entries_tuples:
                if urls[1] not in seen:
                    results.append(urls)
                    seen.add(urls[1])
        except requests.exceptions.HTTPError as e:
            if e.response.status_code == 503:
                print colored('Google is responding with a Captcha, other searches will continue\n', 'red')
                break
        except AttributeError as f:
            #traceback.print_exc()
            pass
        except Exception:
            print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
            warning(traceback.print_exc())

    q.put(sorted(results))


#Takes [list[tuples]]email~url #Returns [list[tuples]]email_address, url_found, breach_domain, breach_data, breach_date, /
#breach_added, breach_description
def action_pwned(emails):
    pwend_data = []
    seen = set()
    for email in emails:
        link = 'https://haveibeenpwned.com/api/v2/breachedaccount/{}'.format(email)
        try:
            headers = {"Connection" : "close",
                       "User-Agent" : "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
                       'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
Esempio n. 17
0
            for urls in entries_tuples:
                if urls[1] not in seen:
                    results.append(urls)
                    seen.add(urls[1])
        except requests.exceptions.HTTPError as e:
            if e.response.status_code == 503:
                print colored(
                    'Google is responding with a Captcha, other searches will continue\n',
                    'red')
                break
        except AttributeError as f:
            #traceback.print_exc()
            pass
        except Exception:
            print 'An Unhandled Exception Has Occured, Please Check The Log For Details'
            warning(traceback.print_exc())

    q.put(sorted(results))


#Takes [list[tuples]]email~url #Returns [list[tuples]]email_address, url_found, breach_domain, breach_data, breach_date, /
#breach_added, breach_description
def action_pwned(emails):
    pwend_data = []
    seen = set()
    for email in emails:
        link = 'https://haveibeenpwned.com/api/v2/breachedaccount/{}'.format(
            email)
        try:
            headers = {
                "Connection": "close",