Update sublist3r.py

removing virus total
This commit is contained in:
Kaustubh BM 2023-01-31 14:23:49 +05:30 committed by GitHub
parent 8bc51ecee8
commit f79a38dae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 53 additions and 68 deletions

View File

@ -72,15 +72,7 @@ def no_color():
def banner(): def banner():
print("""%s return
____ _ _ _ _ _____
/ ___| _ _| |__ | (_)___| |_|___ / _ __
\___ \| | | | '_ \| | / __| __| |_ \| '__|
___) | |_| | |_) | | \__ \ |_ ___) | |
|____/ \__,_|_.__/|_|_|___/\__|____/|_|%s%s
# Coded By Ahmed Aboul-Ela - @aboul3la
""" % (R, W, Y))
def parser_error(errmsg): def parser_error(errmsg):
@ -99,7 +91,6 @@ def parse_args():
parser.add_argument('-b', '--bruteforce', help='Enable the subbrute bruteforce module', nargs='?', default=False) parser.add_argument('-b', '--bruteforce', help='Enable the subbrute bruteforce module', nargs='?', default=False)
parser.add_argument('-p', '--ports', help='Scan the found subdomains against specified tcp ports') parser.add_argument('-p', '--ports', help='Scan the found subdomains against specified tcp ports')
parser.add_argument('-v', '--verbose', help='Enable Verbosity and display results in realtime', nargs='?', default=False) parser.add_argument('-v', '--verbose', help='Enable Verbosity and display results in realtime', nargs='?', default=False)
parser.add_argument('-s', '--silent', help='Disables verbosity and runs the script silently', nargs='?', default=False)
parser.add_argument('-t', '--threads', help='Number of threads to use for subbrute bruteforce', type=int, default=30) parser.add_argument('-t', '--threads', help='Number of threads to use for subbrute bruteforce', type=int, default=30)
parser.add_argument('-e', '--engines', help='Specify a comma-separated list of search engines') parser.add_argument('-e', '--engines', help='Specify a comma-separated list of search engines')
parser.add_argument('-o', '--output', help='Save the results to text file') parser.add_argument('-o', '--output', help='Save the results to text file')
@ -674,55 +665,55 @@ class DNSdumpster(enumratorBaseThreaded):
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 []
base_url = 'https://www.virustotal.com/ui/domains/{domain}/subdomains' # base_url = 'https://www.virustotal.com/ui/domains/{domain}/subdomains'
self.engine_name = "Virustotal" # self.engine_name = "Virustotal"
self.q = q # self.q = q
super(Virustotal, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) # super(Virustotal, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose)
self.url = self.base_url.format(domain=self.domain) # self.url = self.base_url.format(domain=self.domain)
return # return
#
# 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):
try: # try:
resp = self.session.get(url, headers=self.headers, timeout=self.timeout) # resp = self.session.get(url, headers=self.headers, timeout=self.timeout)
except Exception as e: # except Exception as e:
self.print_(e) # self.print_(e)
resp = None # resp = None
#
return self.get_response(resp) # return self.get_response(resp)
#
# once the send_req is rewritten we don't need to call this function, the stock one should be ok # # once the send_req is rewritten we don't need to call this function, the stock one should be ok
def enumerate(self): # def enumerate(self):
while self.url != '': # while self.url != '':
resp = self.send_req(self.url) # resp = self.send_req(self.url)
resp = json.loads(resp) # resp = json.loads(resp)
if 'error' in resp: # if 'error' in resp:
self.print_(R + "[!] Error: Virustotal probably now is blocking our requests" + W) # self.print_(R + "[!] Error: Virustotal probably now is blocking our requests" + W)
break # break
if 'links' in resp and 'next' in resp['links']: # if 'links' in resp and 'next' in resp['links']:
self.url = resp['links']['next'] # self.url = resp['links']['next']
else: # else:
self.url = '' # self.url = ''
self.extract_domains(resp) # self.extract_domains(resp)
return self.subdomains # return self.subdomains
#
def extract_domains(self, resp): # def extract_domains(self, resp):
#resp is already parsed as json # #resp is already parsed as json
try: # try:
for i in resp['data']: # for i in resp['data']:
if i['type'] == 'domain': # if i['type'] == 'domain':
subdomain = i['id'] # subdomain = i['id']
if not subdomain.endswith(self.domain): # if not subdomain.endswith(self.domain):
continue # continue
if subdomain not in self.subdomains and subdomain != 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:
pass # pass
class ThreatCrowd(enumratorBaseThreaded): class ThreatCrowd(enumratorBaseThreaded):
@ -920,7 +911,6 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
'ask': AskEnum, 'ask': AskEnum,
'netcraft': NetcraftEnum, 'netcraft': NetcraftEnum,
'dnsdumpster': DNSdumpster, 'dnsdumpster': DNSdumpster,
'virustotal': Virustotal,
'threatcrowd': ThreatCrowd, 'threatcrowd': ThreatCrowd,
'ssl': CrtSearch, 'ssl': CrtSearch,
'passivedns': PassiveDNS 'passivedns': PassiveDNS
@ -931,7 +921,7 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
if engines is None: if engines is None:
chosenEnums = [ chosenEnums = [
BaiduEnum, YahooEnum, GoogleEnum, BingEnum, AskEnum, BaiduEnum, YahooEnum, GoogleEnum, BingEnum, AskEnum,
NetcraftEnum, DNSdumpster, Virustotal, ThreatCrowd, NetcraftEnum, ThreatCrowd,
CrtSearch, PassiveDNS CrtSearch, PassiveDNS
] ]
else: else:
@ -995,18 +985,13 @@ def interactive():
ports = args.ports ports = args.ports
enable_bruteforce = args.bruteforce enable_bruteforce = args.bruteforce
verbose = args.verbose verbose = args.verbose
silent = args.silent
engines = args.engines engines = args.engines
if verbose or verbose is None: if verbose or verbose is None:
verbose = True verbose = True
if silent:
verbose = False
silent = True
if args.no_color: if args.no_color:
no_color() no_color()
if not silent or silent is None:
banner() banner()
res = main(domain, threads, savefile, ports, silent=silent, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines) res = main(domain, threads, savefile, ports, silent= True, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines)
if __name__ == "__main__": if __name__ == "__main__":
interactive() interactive()