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

optimization support -p 80,7001-9009, auto save to domain + ".txt" file #323

Open
wants to merge 5 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
19 changes: 12 additions & 7 deletions sublist3r.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def banner():
\___ \| | | | '_ \| | / __| __| |_ \| '__|
___) | |_| | |_) | | \__ \ |_ ___) | |
|____/ \__,_|_.__/|_|_|___/\__|____/|_|%s%s

# Coded By Ahmed Aboul-Ela - @aboul3la
""" % (R, W, Y))

Expand All @@ -102,6 +101,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('-u', '--url', help='Save the results to url')
parser.add_argument('-n', '--no-color', help='Output without color', default=False, action='store_true')
return parser.parse_args()

Expand All @@ -116,11 +116,9 @@ def write_file(filename, subdomains):

def subdomain_sorting_key(hostname):
"""Sorting key for subdomains

This sorting key orders subdomains from the top-level domain at the right
reading left, then moving '^' and 'www' to the top of their group. For
example, the following list is sorted correctly:

[
'example.com',
'www.example.com',
Expand All @@ -132,7 +130,6 @@ def subdomain_sorting_key(hostname):
'www.example.net',
'a.example.net',
]

"""
parts = hostname.split('.')[::-1]
if parts[-1] == 'www':
Expand Down Expand Up @@ -881,7 +878,7 @@ def run(self):
t.start()


def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, engines):
def main(domain, threads, savefile,url, ports, silent, verbose, enable_bruteforce, engines):
bruteforce_list = set()
search_list = set()

Expand Down Expand Up @@ -969,6 +966,13 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e

if savefile:
write_file(savefile, subdomains)

if url:
requests.post(url, json={"domain":domain,"subdomains":subdomains},verify=False, headers={
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
"content-type":"application/json",
"Connection": "close"
},timeout=None,allow_redirects=False)

if not silent:
print(Y + "[-] Total Unique Subdomains Found: %s" % len(subdomains) + W)
Expand All @@ -991,6 +995,7 @@ def interactive():
domain = args.domain
threads = args.threads
savefile = args.output
url = args.url
ports = args.ports
enable_bruteforce = args.bruteforce
verbose = args.verbose
Expand All @@ -1000,7 +1005,7 @@ def interactive():
if args.no_color:
no_color()
banner()
res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines)
res = main(domain, threads, savefile,url, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines)

if __name__ == "__main__":
interactive()
interactive()