Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self.headers changed and virus total apikey fixed #345

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions sublist3r.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def parse_args():
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('-o', '--output', help='Save the results to text file')
parser.add_argument('-vt', '--virustotal_apikey', help='Virustotal API Key', default='<your-apikey>')
parser.add_argument('-n', '--no-color', help='Output without color', default=False, action='store_true')
return parser.parse_args()

Expand Down Expand Up @@ -152,10 +153,10 @@ def __init__(self, base_url, engine_name, domain, subdomains=None, silent=False,
self.silent = silent
self.verbose = verbose
self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.8',
'Accept-Encoding': 'gzip',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
}
self.print_banner()

Expand Down Expand Up @@ -676,7 +677,7 @@ def extract_domains(self, resp):
class Virustotal(enumratorBaseThreaded):
def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True):
subdomains = subdomains or []
base_url = 'https://www.virustotal.com/ui/domains/{domain}/subdomains'
base_url = 'https://www.virustotal.com/api/v3/domains/{domain}/subdomains'
self.engine_name = "Virustotal"
self.q = q
super(Virustotal, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose)
Expand All @@ -686,7 +687,10 @@ def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True):
# the main send_req need to be rewritten
def send_req(self, url):
try:
resp = self.session.get(url, headers=self.headers, timeout=self.timeout)
global vt_apikey
headers = dict(self.headers)
headers['x-apikey'] = vt_apikey
resp = self.session.get(url, headers=headers, timeout=self.timeout)
except Exception as e:
self.print_(e)
resp = None
Expand Down Expand Up @@ -987,6 +991,7 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e


def interactive():
global vt_apikey
args = parse_args()
domain = args.domain
threads = args.threads
Expand All @@ -995,6 +1000,7 @@ def interactive():
enable_bruteforce = args.bruteforce
verbose = args.verbose
engines = args.engines
vt_apikey = args.virustotal_apikey
if verbose or verbose is None:
verbose = True
if args.no_color:
Expand Down