diff --git a/.gitignore b/.gitignore index e69de29..4c49bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/recon.py b/recon.py index f517372..e79c575 100644 --- a/recon.py +++ b/recon.py @@ -42,10 +42,12 @@ wordlists = [ ] TIPS = [ f"you can add some wordlists in the config file /home/{getpass.getuser()}/.config/recon/wordlists.txt", - f"\n{Colors.RED}RED{Colors.END} = CRITICAL\n{Colors.ORANGE}ORANGE{Colors.END} = MID\n{Colors.GREEN}GREEN{Colors.END} = LOW" + f"\n{Colors.RED}RED{Colors.END} = CRITICAL\n{Colors.ORANGE}ORANGE{Colors.END} = MID\n{Colors.GREEN}GREEN{Colors.END} = LOW", + f"for further enumeration install the projectdiscovery.io suits (subfinder, nuclei, katana and httpx)" ] -CONFIG_FOLDER = f"/home/{getpass.getuser()}/.config/recon" +#CONFIG_FOLDER = f"/home/{getpass.getuser()}/.config/recon" +CONFIG_FOLDER = f"/home/coder/.config/recon" if not os.path.isdir(SCANFOLDER): os.makedirs(SCANFOLDER) if not os.path.isdir(CONFIG_FOLDER): @@ -548,10 +550,10 @@ def subdnsfind(target): print(f"-> {Colors.ORANGE}{subdomain}{Colors.END}") for subdomain in subdomains: subdomain=subdomain.strip() - threads.append([threading.Thread(target=nmap_full_scan,args=(subdomain,True)),f" {subdomain} NMAP FULL SCAN "]) - threads[-1][0].start() + open_ports_tcp = tcp_scan(subdomain) - + threads.append([threading.Thread(target=nmap_full_scan,args=(subdomain,open_ports_tcp,True)),f" {subdomain} NMAP FULL SCAN "]) + threads[-1][0].start() rapport.append(f"\n {subdomain} TCP OPEN PORTS:") rapport += [f"{port}/TCP" for port in open_ports_tcp] print("\n\n") @@ -600,15 +602,21 @@ def subdnsfind(target): rapport += [line.strip() for line in f if line.strip()] analyze_directories(target, output_file, use_https, rapport) -def nmap_full_scan(target,subdomain=False): - output=f"scan_{target}.txt" - if subdomain: - check = subprocess.run(f"nmap -A -T5 -oN {output} -p- {target}",shell=True,capture_output=False,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) - else: - check = subprocess.run(f"nmap -A -T5 -oN {output} -p- --script http-title --script-args http.max-redirects=3 {target}",shell=True,capture_output=False,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) +def nmap_full_scan(target,open_ports,subdomain=False): + if shutil.which("nmap") is not None: + output=f"scan_{target}.txt" + ports = ",".join(str(p) for p in open_ports) + if subdomain: + print(f"running : nmap -A -T5 -oN {output} -p {ports} {target}") + check = subprocess.run(f"nmap -A -T5 -oN {output} -p {ports} {target}",shell=True,capture_output=False,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) + else: + print(f"running : nmap -A -T5 -oN {output} -p {ports} --script http-title --script-args http.max-redirects=3 {target}") + check = subprocess.run(f"nmap -A -T5 -oN {output} -p {ports} --script http-title --script-args http.max-redirects=3 {target}",shell=True,capture_output=False,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) - if check and os.path.isfile(output): - print(f"nmap scan run correctly and saved to {output}") + if check and os.path.isfile(output): + print(f"nmap scan run correctly and saved to {output}") + else: + print("Install Nmap for a more detailed scan !") def main(): global services,threads,rapport @@ -642,14 +650,15 @@ def main(): except socket.error: print("Unable to resolve target.") sys.exit(1) + os.chdir(SCANFOLDER) if not os.path.isdir(target): os.makedirs(target) os.chdir(target) print(f"IP: {ip}") rapport.append(f"Scanning {ip}") - threads.append([threading.Thread(target=nmap_full_scan,args=(target,)),"NMAP FULL SCAN"]) - threads[-1][0].start() open_ports_tcp = tcp_scan(target) + threads.append([threading.Thread(target=nmap_full_scan,args=(target,open_ports_tcp)),"NMAP FULL SCAN"]) + threads[-1][0].start() rapport.append("\nTCP OPEN PORTS:") rapport += [f"{port}/TCP" for port in open_ports_tcp] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f229360 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests