Skip to content

Commit 281608a

Browse files
committed
refactor(subfinder.main): add mode selection for subfinder(passive) and subbrute(active) modes
1 parent 7a4f334 commit 281608a

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

bugscanx/modules/scrapers/subfinder/subfinder.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,29 @@ def run(self, domains, output_file, sources):
7979

8080

8181
def main():
82-
domains = []
83-
sources = get_sources()
84-
input_type = get_input("Select input mode", "choice",
85-
choices=["Manual", "File"])
86-
87-
if input_type == "Manual":
88-
domain_input = get_input("Enter domain(s)")
89-
domains = [d.strip() for d in domain_input.split(',') if DomainValidator.is_valid_domain(d.strip())]
90-
default_output = f"{domains[0]}_subdomains.txt" if domains else "subdomains.txt"
82+
scanner_choice = get_input("Select Enumeration Mode", "choice",
83+
choices=["SubFinder (passive)", "SubBrute (active)"])
84+
85+
if scanner_choice == "SubBrute (active)":
86+
from .subbrute.subbrute import main as subbrute_main
87+
subbrute_main()
88+
9189
else:
92-
file_path = get_input("Enter filename", "file")
93-
with open(file_path, 'r') as f:
94-
domains = [d.strip() for d in f if DomainValidator.is_valid_domain(d.strip())]
95-
default_output = f"{file_path.rsplit('.', 1)[0]}_subdomains.txt"
96-
97-
output_file = get_input("Enter output filename", default=default_output)
98-
subfinder = SubFinder()
99-
subfinder.run(domains, output_file, sources)
90+
domains = []
91+
sources = get_sources()
92+
input_type = get_input("Select input mode", "choice",
93+
choices=["Manual", "File"])
94+
95+
if input_type == "Manual":
96+
domain_input = get_input("Enter domain(s)")
97+
domains = [d.strip() for d in domain_input.split(',') if DomainValidator.is_valid_domain(d.strip())]
98+
default_output = f"{domains[0]}_subdomains.txt" if domains else "subdomains.txt"
99+
else:
100+
file_path = get_input("Enter filename", "file")
101+
with open(file_path, 'r') as f:
102+
domains = [d.strip() for d in f if DomainValidator.is_valid_domain(d.strip())]
103+
default_output = f"{file_path.rsplit('.', 1)[0]}_subdomains.txt"
104+
105+
output_file = get_input("Enter output filename", default=default_output)
106+
subfinder = SubFinder()
107+
subfinder.run(domains, output_file, sources)

0 commit comments

Comments
 (0)