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 threading
|
||||
import socket
|
||||
import json
|
||||
from collections import Counter
|
||||
|
||||
# external modules
|
||||
|
@ -727,12 +728,6 @@ class ThreatCrowd(enumratorBaseThreaded):
|
|||
return self.subdomains
|
||||
|
||||
def extract_domains(self, resp):
|
||||
try:
|
||||
import json
|
||||
except Exception as e:
|
||||
self.print_(e)
|
||||
return
|
||||
|
||||
try:
|
||||
links = json.loads(resp)['subdomains']
|
||||
for link in links:
|
||||
|
@ -795,35 +790,16 @@ class CrtSearch(enumratorBaseThreaded):
|
|||
class PassiveDNS(enumratorBaseThreaded):
|
||||
def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True):
|
||||
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.lock = threading.Lock()
|
||||
self.q = q
|
||||
super(PassiveDNS, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose)
|
||||
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):
|
||||
try:
|
||||
headers = dict(self.headers)
|
||||
user_agent = self.get_agent()
|
||||
if user_agent:
|
||||
headers['User-Agent'] = user_agent
|
||||
|
||||
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
||||
|
||||
resp = self.session.get(url, headers=self.headers, timeout=self.timeout)
|
||||
except Exception as e:
|
||||
resp = None
|
||||
|
||||
|
@ -839,15 +815,14 @@ class PassiveDNS(enumratorBaseThreaded):
|
|||
return self.subdomains
|
||||
|
||||
def extract_domains(self, resp):
|
||||
link_regx = re.compile('[a-zA-Z0-9.-]*\.'+ self.domain,re.IGNORECASE)
|
||||
try:
|
||||
links = link_regx.findall(resp)
|
||||
for subdomain in links:
|
||||
if subdomain not in self.subdomains and subdomain != self.domain and subdomain.endswith(self.domain):
|
||||
subdomains = json.loads(resp)
|
||||
for subdomain in subdomains:
|
||||
if subdomain not in self.subdomains and subdomain != self.domain:
|
||||
if self.verbose:
|
||||
self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain))
|
||||
self.subdomains.append(subdomain.strip())
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue