Added whitespaces after commas & operators
This commit is contained in:
parent
7a84f06e93
commit
201d797b87
109
sublist3r.py
109
sublist3r.py
|
|
@ -30,7 +30,8 @@ else:
|
||||||
import urlparse
|
import urlparse
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
#In case you cannot install some of the required development packages, there's also an option to disable the SSL warning:
|
# In case you cannot install some of the required development packages
|
||||||
|
# there's also an option to disable the SSL warning:
|
||||||
try:
|
try:
|
||||||
import requests.packages.urllib3
|
import requests.packages.urllib3
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
|
@ -42,7 +43,9 @@ is_windows = sys.platform.startswith('win')
|
||||||
|
|
||||||
# Console Colors
|
# Console Colors
|
||||||
if is_windows:
|
if is_windows:
|
||||||
G = Y = B = R = W = G = Y = B = R = W = '' #use no terminal colors on windows
|
# use no terminal colors on windows
|
||||||
|
G = Y = B = R = W = G = Y = B = R = W = ''
|
||||||
|
|
||||||
else:
|
else:
|
||||||
G = '\033[92m' # green
|
G = '\033[92m' # green
|
||||||
Y = '\033[93m' # yellow
|
Y = '\033[93m' # yellow
|
||||||
|
|
@ -50,6 +53,7 @@ else:
|
||||||
R = '\033[91m' # red
|
R = '\033[91m' # red
|
||||||
W = '\033[0m' # white
|
W = '\033[0m' # white
|
||||||
|
|
||||||
|
|
||||||
def banner():
|
def banner():
|
||||||
print("""%s
|
print("""%s
|
||||||
____ _ _ _ _ _____
|
____ _ _ _ _ _____
|
||||||
|
|
@ -61,6 +65,7 @@ def banner():
|
||||||
# Coded By Ahmed Aboul-Ela - @aboul3la
|
# Coded By Ahmed Aboul-Ela - @aboul3la
|
||||||
""" % (R, W, Y))
|
""" % (R, W, Y))
|
||||||
|
|
||||||
|
|
||||||
def parser_error(errmsg):
|
def parser_error(errmsg):
|
||||||
banner()
|
banner()
|
||||||
print("Usage: python " + sys.argv[0] + " [Options] use -h for help")
|
print("Usage: python " + sys.argv[0] + " [Options] use -h for help")
|
||||||
|
|
@ -81,6 +86,7 @@ def parse_args():
|
||||||
parser.add_argument('-o', '--output', help='Save the results to text file')
|
parser.add_argument('-o', '--output', help='Save the results to text file')
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def write_file(filename, subdomains):
|
def write_file(filename, subdomains):
|
||||||
# saving subdomains results to output file
|
# saving subdomains results to output file
|
||||||
print("%s[-] Saving results to file: %s%s%s%s" % (Y, W, R, filename, W))
|
print("%s[-] Saving results to file: %s%s%s%s" % (Y, W, R, filename, W))
|
||||||
|
|
@ -88,6 +94,7 @@ def write_file(filename, subdomains):
|
||||||
for subdomain in subdomains:
|
for subdomain in subdomains:
|
||||||
f.write(subdomain + "\r\n")
|
f.write(subdomain + "\r\n")
|
||||||
|
|
||||||
|
|
||||||
def subdomain_cmp(d1, d2):
|
def subdomain_cmp(d1, d2):
|
||||||
"""cmp function for subdomains d1 and d2.
|
"""cmp function for subdomains d1 and d2.
|
||||||
|
|
||||||
|
|
@ -127,6 +134,7 @@ def subdomain_cmp(d1, d2):
|
||||||
val = 1
|
val = 1
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
class enumratorBase(object):
|
class enumratorBase(object):
|
||||||
def __init__(self, base_url, engine_name, domain, subdomains=None, silent=False, verbose=True):
|
def __init__(self, base_url, engine_name, domain, subdomains=None, silent=False, verbose=True):
|
||||||
subdomains = subdomains or []
|
subdomains = subdomains or []
|
||||||
|
|
@ -151,27 +159,25 @@ class enumratorBase(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
def send_req(self, query, page_no=1):
|
def send_req(self, query, page_no=1):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
'Connection': 'keep-alive'
|
'Connection': 'keep-alive',
|
||||||
}
|
}
|
||||||
|
|
||||||
url = self.base_url.format(query=query, page_no=page_no)
|
url = self.base_url.format(query=query, page_no=page_no)
|
||||||
try:
|
try:
|
||||||
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
resp = None
|
resp = None
|
||||||
return self.get_response(resp)
|
return self.get_response(resp)
|
||||||
|
|
||||||
def get_response(self, response):
|
def get_response(self, response):
|
||||||
if response is None:
|
if response is None:
|
||||||
return 0
|
return 0
|
||||||
if hasattr(response, "text"):
|
return response.text if hasattr(response, "text") else response.content
|
||||||
return response.text
|
|
||||||
else:
|
|
||||||
return response.content
|
|
||||||
|
|
||||||
def check_max_subdomains(self, count):
|
def check_max_subdomains(self, count):
|
||||||
if self.MAX_DOMAINS == 0:
|
if self.MAX_DOMAINS == 0:
|
||||||
|
|
@ -183,7 +189,7 @@ class enumratorBase(object):
|
||||||
return False
|
return False
|
||||||
return num >= self.MAX_PAGES
|
return num >= self.MAX_PAGES
|
||||||
|
|
||||||
#Override
|
# override
|
||||||
def extract_domains(self, resp):
|
def extract_domains(self, resp):
|
||||||
""" chlid class should override this function """
|
""" chlid class should override this function """
|
||||||
return
|
return
|
||||||
|
|
@ -260,6 +266,7 @@ class enumratorBaseThreaded(multiprocessing.Process, enumratorBase):
|
||||||
for domain in domain_list:
|
for domain in domain_list:
|
||||||
self.q.append(domain)
|
self.q.append(domain)
|
||||||
|
|
||||||
|
|
||||||
class GoogleEnum(enumratorBaseThreaded):
|
class GoogleEnum(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 []
|
||||||
|
|
@ -284,7 +291,7 @@ class GoogleEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return links_list
|
return links_list
|
||||||
|
|
||||||
|
|
@ -308,6 +315,7 @@ class GoogleEnum(enumratorBaseThreaded):
|
||||||
query = "site:{domain} -www.{domain}".format(domain=self.domain)
|
query = "site:{domain} -www.{domain}".format(domain=self.domain)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
class YahooEnum(enumratorBaseThreaded):
|
class YahooEnum(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 []
|
||||||
|
|
@ -338,7 +346,7 @@ class YahooEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return links_list
|
return links_list
|
||||||
|
|
@ -358,6 +366,7 @@ class YahooEnum(enumratorBaseThreaded):
|
||||||
query = "site:{domain}".format(domain=self.domain)
|
query = "site:{domain}".format(domain=self.domain)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
class AskEnum(enumratorBaseThreaded):
|
class AskEnum(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 []
|
||||||
|
|
@ -381,7 +390,7 @@ class AskEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return links_list
|
return links_list
|
||||||
|
|
@ -399,6 +408,7 @@ class AskEnum(enumratorBaseThreaded):
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
class BingEnum(enumratorBaseThreaded):
|
class BingEnum(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 []
|
||||||
|
|
@ -428,7 +438,7 @@ class BingEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return links_list
|
return links_list
|
||||||
|
|
@ -442,6 +452,7 @@ class BingEnum(enumratorBaseThreaded):
|
||||||
query = "domain:{domain} -www.{domain}".format(domain=self.domain)
|
query = "domain:{domain} -www.{domain}".format(domain=self.domain)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
class BaiduEnum(enumratorBaseThreaded):
|
class BaiduEnum(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 []
|
||||||
|
|
@ -472,7 +483,7 @@ class BaiduEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
if not found_newdomain and subdomain_list:
|
if not found_newdomain and subdomain_list:
|
||||||
self.querydomain = self.findsubs(subdomain_list)
|
self.querydomain = self.findsubs(subdomain_list)
|
||||||
|
|
@ -500,6 +511,7 @@ class BaiduEnum(enumratorBaseThreaded):
|
||||||
query = "site:{domain} -site:www.{domain}".format(domain=self.domain)
|
query = "site:{domain} -site:www.{domain}".format(domain=self.domain)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
class NetcraftEnum(enumratorBaseThreaded):
|
class NetcraftEnum(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 []
|
||||||
|
|
@ -512,11 +524,13 @@ class NetcraftEnum(enumratorBaseThreaded):
|
||||||
|
|
||||||
def req(self, url, cookies=None):
|
def req(self, url, cookies=None):
|
||||||
cookies = cookies or {}
|
cookies = cookies or {}
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = self.session.get(url, headers=headers, timeout=self.timeout,cookies=cookies)
|
resp = self.session.get(url, headers=headers, timeout=self.timeout,cookies=cookies)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -570,7 +584,7 @@ class NetcraftEnum(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return links_list
|
return links_list
|
||||||
|
|
||||||
|
|
@ -606,7 +620,8 @@ class DNSdumpster(enumratorBaseThreaded):
|
||||||
|
|
||||||
def req(self, req_method, url, params=None):
|
def req(self, req_method, url, params=None):
|
||||||
params = params or {}
|
params = params or {}
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
|
@ -658,6 +673,7 @@ class DNSdumpster(enumratorBaseThreaded):
|
||||||
self.subdomains.append(subdomain.strip())
|
self.subdomains.append(subdomain.strip())
|
||||||
return links
|
return links
|
||||||
|
|
||||||
|
|
||||||
class Virustotal(enumratorBaseThreaded):
|
class Virustotal(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 []
|
||||||
|
|
@ -671,7 +687,8 @@ class Virustotal(enumratorBaseThreaded):
|
||||||
|
|
||||||
# the main send_req need to be rewritten
|
# the main send_req need to be rewritten
|
||||||
def send_req(self, url):
|
def send_req(self, url):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
|
@ -704,7 +721,7 @@ class Virustotal(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -720,7 +737,8 @@ class ThreatCrowd(enumratorBaseThreaded):
|
||||||
return
|
return
|
||||||
|
|
||||||
def req(self, url):
|
def req(self, url):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
|
@ -728,7 +746,7 @@ class ThreatCrowd(enumratorBaseThreaded):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
resp = None
|
resp = None
|
||||||
|
|
||||||
return self.get_response(resp)
|
return self.get_response(resp)
|
||||||
|
|
@ -746,7 +764,6 @@ class ThreatCrowd(enumratorBaseThreaded):
|
||||||
self.print_(e)
|
self.print_(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
links = json.loads(resp)['subdomains']
|
links = json.loads(resp)['subdomains']
|
||||||
for link in links:
|
for link in links:
|
||||||
|
|
@ -760,6 +777,7 @@ class ThreatCrowd(enumratorBaseThreaded):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CrtSearch(enumratorBaseThreaded):
|
class CrtSearch(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 []
|
||||||
|
|
@ -772,7 +790,8 @@ class CrtSearch(enumratorBaseThreaded):
|
||||||
return
|
return
|
||||||
|
|
||||||
def req(self, url):
|
def req(self, url):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
|
@ -780,7 +799,7 @@ class CrtSearch(enumratorBaseThreaded):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
resp = self.session.get(url, headers=headers, timeout=self.timeout)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
resp = None
|
resp = None
|
||||||
|
|
||||||
return self.get_response(resp)
|
return self.get_response(resp)
|
||||||
|
|
@ -807,6 +826,7 @@ class CrtSearch(enumratorBaseThreaded):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
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 []
|
||||||
|
|
@ -819,7 +839,8 @@ class PassiveDNS(enumratorBaseThreaded):
|
||||||
return
|
return
|
||||||
|
|
||||||
def req(self, url):
|
def req(self, url):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/40.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'Accept-Language': 'en-GB,en;q=0.5',
|
'Accept-Language': 'en-GB,en;q=0.5',
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
|
@ -833,7 +854,6 @@ class PassiveDNS(enumratorBaseThreaded):
|
||||||
|
|
||||||
return self.get_response(resp)
|
return self.get_response(resp)
|
||||||
|
|
||||||
|
|
||||||
def enumerate(self):
|
def enumerate(self):
|
||||||
url = self.base_url.format(domain=self.domain)
|
url = self.base_url.format(domain=self.domain)
|
||||||
resp = self.req(url)
|
resp = self.req(url)
|
||||||
|
|
@ -852,11 +872,11 @@ class PassiveDNS(enumratorBaseThreaded):
|
||||||
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 as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class portscan():
|
|
||||||
|
|
||||||
|
class portscan():
|
||||||
def __init__(self, subdomains, ports):
|
def __init__(self, subdomains, ports):
|
||||||
self.subdomains = subdomains
|
self.subdomains = subdomains
|
||||||
self.ports = ports
|
self.ports = ports
|
||||||
|
|
@ -874,7 +894,7 @@ class portscan():
|
||||||
if result == 0:
|
if result == 0:
|
||||||
openports.append(port)
|
openports.append(port)
|
||||||
s.close()
|
s.close()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
if len(openports) > 0:
|
if len(openports) > 0:
|
||||||
|
|
@ -894,16 +914,15 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
else:
|
else:
|
||||||
subdomains_queue = multiprocessing.Manager().list()
|
subdomains_queue = multiprocessing.Manager().list()
|
||||||
|
|
||||||
|
|
||||||
# Check Bruteforce Status
|
# Check Bruteforce Status
|
||||||
|
|
||||||
if enable_bruteforce or enable_bruteforce is None:
|
if enable_bruteforce or enable_bruteforce is None:
|
||||||
enable_bruteforce = True
|
enable_bruteforce = True
|
||||||
|
|
||||||
# Validate domain
|
# Validate domain
|
||||||
domain_check = re.compile("^(http|https)?[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,}$")
|
domain_check = re.compile("^(http|https)?[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,}$")
|
||||||
if not domain_check.match(domain):
|
if not domain_check.match(domain):
|
||||||
if not silent: print(R+"Error: Please enter a valid domain"+W)
|
if not silent:
|
||||||
|
print(R + "Error: Please enter a valid domain" + W)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if not domain.startswith('http://') or not domain.startswith('https://'):
|
if not domain.startswith('http://') or not domain.startswith('https://'):
|
||||||
|
|
@ -911,7 +930,8 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
|
|
||||||
parsed_domain = urlparse.urlparse(domain)
|
parsed_domain = urlparse.urlparse(domain)
|
||||||
|
|
||||||
if not silent: print(B+"[-] Enumerating subdomains now for %s"%parsed_domain.netloc+W)
|
if not silent:
|
||||||
|
print(B + "[-] Enumerating subdomains now for %s"%parsed_domain.netloc + W)
|
||||||
|
|
||||||
if verbose and not silent:
|
if verbose and not silent:
|
||||||
print(Y + "[-] verbosity is enabled, will show the subdomains results in realtime" + W)
|
print(Y + "[-] verbosity is enabled, will show the subdomains results in realtime" + W)
|
||||||
|
|
@ -931,9 +951,12 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
|
|
||||||
chosenEnums = []
|
chosenEnums = []
|
||||||
|
|
||||||
if engines == None:
|
if engines is None:
|
||||||
chosenEnums = [BaiduEnum, YahooEnum, GoogleEnum, BingEnum, AskEnum,
|
chosenEnums = [
|
||||||
NetcraftEnum, DNSdumpster, Virustotal, ThreatCrowd, CrtSearch, PassiveDNS]
|
BaiduEnum, YahooEnum, GoogleEnum, BingEnum, AskEnum,
|
||||||
|
NetcraftEnum, DNSdumpster, Virustotal, ThreatCrowd,
|
||||||
|
CrtSearch, PassiveDNS
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
engines = engines.split(',')
|
engines = engines.split(',')
|
||||||
for engine in engines:
|
for engine in engines:
|
||||||
|
|
@ -952,7 +975,8 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
search_list.add(subdomain)
|
search_list.add(subdomain)
|
||||||
|
|
||||||
if enable_bruteforce:
|
if enable_bruteforce:
|
||||||
if not silent: print(G+"[-] Starting bruteforce module now using subbrute.."+W)
|
if not silent:
|
||||||
|
print(G + "[-] Starting bruteforce module now using subbrute.." + W)
|
||||||
record_type = False
|
record_type = False
|
||||||
path_to_file = os.path.dirname(os.path.realpath(__file__))
|
path_to_file = os.path.dirname(os.path.realpath(__file__))
|
||||||
subs = os.path.join(path_to_file, 'subbrute', 'names.txt')
|
subs = os.path.join(path_to_file, 'subbrute', 'names.txt')
|
||||||
|
|
@ -972,10 +996,12 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
if savefile:
|
if savefile:
|
||||||
write_file(savefile, subdomains)
|
write_file(savefile, subdomains)
|
||||||
|
|
||||||
if not silent: print(Y+"[-] Total Unique Subdomains Found: %s"%len(subdomains)+W)
|
if not silent:
|
||||||
|
print(Y + "[-] Total Unique Subdomains Found: %s" % len(subdomains) + W)
|
||||||
|
|
||||||
if ports:
|
if ports:
|
||||||
if not silent: print(G+"[-] Start port scan now for the following ports: %s%s"%(Y,ports)+W)
|
if not silent:
|
||||||
|
print(G + "[-] Start port scan now for the following ports: %s%s" % (Y,ports) + W)
|
||||||
ports = ports.split(',')
|
ports = ports.split(',')
|
||||||
pscan = portscan(subdomains, ports)
|
pscan = portscan(subdomains, ports)
|
||||||
pscan.run()
|
pscan.run()
|
||||||
|
|
@ -985,6 +1011,7 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
print(G + subdomain + W)
|
print(G + subdomain + W)
|
||||||
return subdomains
|
return subdomains
|
||||||
|
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
domain = args.domain
|
domain = args.domain
|
||||||
|
|
@ -996,7 +1023,5 @@ if __name__=="__main__":
|
||||||
engines = args.engines
|
engines = args.engines
|
||||||
if verbose or verbose is None:
|
if verbose or verbose is None:
|
||||||
verbose = True
|
verbose = True
|
||||||
|
|
||||||
|
|
||||||
banner()
|
banner()
|
||||||
res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines)
|
res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue