Removed Bogus PTRarchive & fixed the PassiveDNS Engine
This commit is contained in:
parent
35cf6ee70b
commit
9673dcddb8
39
sublist3r.py
39
sublist3r.py
|
@ -14,6 +14,7 @@ import random
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import threading
|
import threading
|
||||||
import socket
|
import socket
|
||||||
|
import json
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
# external modules
|
# external modules
|
||||||
|
@ -727,12 +728,6 @@ class ThreatCrowd(enumratorBaseThreaded):
|
||||||
return self.subdomains
|
return self.subdomains
|
||||||
|
|
||||||
def extract_domains(self, resp):
|
def extract_domains(self, resp):
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except Exception as e:
|
|
||||||
self.print_(e)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
links = json.loads(resp)['subdomains']
|
links = json.loads(resp)['subdomains']
|
||||||
for link in links:
|
for link in links:
|
||||||
|
@ -795,35 +790,16 @@ class CrtSearch(enumratorBaseThreaded):
|
||||||
class PassiveDNS(enumratorBaseThreaded):
|
class PassiveDNS(enumratorBaseThreaded):
|
||||||
def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True):
|
def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True):
|
||||||
subdomains = subdomains or []
|
subdomains = subdomains or []
|
||||||
base_url = 'http://ptrarchive.com/tools/search.htm?label={domain}'
|
base_url = 'https://api.sublist3r.com/search.php?domain={domain}'
|
||||||
self.engine_name = "PassiveDNS"
|
self.engine_name = "PassiveDNS"
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.q = q
|
self.q = q
|
||||||
super(PassiveDNS, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose)
|
super(PassiveDNS, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_agent(self,ua=None):
|
|
||||||
agents_url = 'http://www.webuseragents.com/recent'
|
|
||||||
try:
|
|
||||||
resp = self.session.get(agents_url, headers=self.headers, timeout=self.timeout)
|
|
||||||
agents_list = self.get_response(resp)
|
|
||||||
agents_regex = re.compile('<a href="/ua/.*?>(.*)</a>')
|
|
||||||
agents = agents_regex.findall(agents_list)
|
|
||||||
ua = random.choice(agents)
|
|
||||||
except Exception as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return ua
|
|
||||||
|
|
||||||
def req(self, url):
|
def req(self, url):
|
||||||
try:
|
try:
|
||||||
headers = dict(self.headers)
|
resp = self.session.get(url, headers=self.headers, timeout=self.timeout)
|
||||||
user_agent = self.get_agent()
|
|
||||||
if user_agent:
|
|
||||||
headers['User-Agent'] = user_agent
|
|
||||||
|
|
||||||
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
resp = None
|
resp = None
|
||||||
|
|
||||||
|
@ -839,15 +815,14 @@ class PassiveDNS(enumratorBaseThreaded):
|
||||||
return self.subdomains
|
return self.subdomains
|
||||||
|
|
||||||
def extract_domains(self, resp):
|
def extract_domains(self, resp):
|
||||||
link_regx = re.compile('[a-zA-Z0-9.-]*\.'+ self.domain,re.IGNORECASE)
|
|
||||||
try:
|
try:
|
||||||
links = link_regx.findall(resp)
|
subdomains = json.loads(resp)
|
||||||
for subdomain in links:
|
for subdomain in subdomains:
|
||||||
if subdomain not in self.subdomains and subdomain != self.domain and subdomain.endswith(self.domain):
|
if subdomain not in self.subdomains and subdomain != self.domain:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain))
|
self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain))
|
||||||
self.subdomains.append(subdomain.strip())
|
self.subdomains.append(subdomain.strip())
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue