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 2 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
27 changes: 24 additions & 3 deletions sublist3r.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def parse_args():
def write_file(filename, subdomains):
# saving subdomains results to output file
print("%s[-] Saving results to file: %s%s%s%s" % (Y, W, R, filename, W))
with open(str(filename), 'wt') as f:
with open(str(filename), 'a+') as f:
for subdomain in subdomains:
f.write(subdomain + os.linesep)

Expand Down Expand Up @@ -637,7 +637,11 @@ def req(self, req_method, url, params=None):

def get_csrftoken(self, resp):
csrf_regex = re.compile('<input type="hidden" name="csrfmiddlewaretoken" value="(.*?)">', re.S)
token = csrf_regex.findall(resp)[0]
token = csrf_regex.findall(resp)
if token and 0 < len(token):
token=token[0]
else:
token=""
return token.strip()

def enumerate(self):
Expand Down Expand Up @@ -971,7 +975,22 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
if ports:
if not silent:
print(G + "[-] Start port scan now for the following ports: %s%s" % (Y, ports) + W)
ports = ports.split(',')
# ports = ports.split(',')
ports=re.split(r'[,;\|]',ports)
daX=[]
aX=[]
try:
for x in ports:
if '-' in x or '~' in x:
daX.append(x)
x1=re.split(r'[\-~]',x)
aX=aX+range(x1[0],x1[1])
for x in daX:
ports.remove(x)
ports=ports+aX
except Exception as e:
# print(e)
pass
pscan = portscan(subdomains, ports)
pscan.run()

Expand All @@ -986,6 +1005,8 @@ def interactive():
domain = args.domain
threads = args.threads
savefile = args.output
if None == savefile and domain:
savefile=domain + ".txt"
ports = args.ports
enable_bruteforce = args.bruteforce
verbose = args.verbose
Expand Down