upgraded the nmap scan speed by scanning only open ports instead of all the 65535 ports
This commit is contained in:
1 parent
f02867ecbc
commit
93d65bb2be
3 files changed
+26
-15
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
@@ -42,10 +42,12 @@ wordlists = [
|
|||||||
]
|
]
|
||||||
TIPS = [
|
TIPS = [
|
||||||
f"you can add some wordlists in the config file /home/{getpass.getuser()}/.config/recon/wordlists.txt",
|
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):
|
if not os.path.isdir(SCANFOLDER):
|
||||||
os.makedirs(SCANFOLDER)
|
os.makedirs(SCANFOLDER)
|
||||||
if not os.path.isdir(CONFIG_FOLDER):
|
if not os.path.isdir(CONFIG_FOLDER):
|
||||||
@@ -548,10 +550,10 @@ def subdnsfind(target):
|
|||||||
print(f"-> {Colors.ORANGE}{subdomain}{Colors.END}")
|
print(f"-> {Colors.ORANGE}{subdomain}{Colors.END}")
|
||||||
for subdomain in subdomains:
|
for subdomain in subdomains:
|
||||||
subdomain=subdomain.strip()
|
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)
|
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.append(f"\n {subdomain} TCP OPEN PORTS:")
|
||||||
rapport += [f"{port}/TCP" for port in open_ports_tcp]
|
rapport += [f"{port}/TCP" for port in open_ports_tcp]
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
@@ -600,15 +602,21 @@ def subdnsfind(target):
|
|||||||
rapport += [line.strip() for line in f if line.strip()]
|
rapport += [line.strip() for line in f if line.strip()]
|
||||||
analyze_directories(target, output_file, use_https, rapport)
|
analyze_directories(target, output_file, use_https, rapport)
|
||||||
|
|
||||||
def nmap_full_scan(target,subdomain=False):
|
def nmap_full_scan(target,open_ports,subdomain=False):
|
||||||
output=f"scan_{target}.txt"
|
if shutil.which("nmap") is not None:
|
||||||
if subdomain:
|
output=f"scan_{target}.txt"
|
||||||
check = subprocess.run(f"nmap -A -T5 -oN {output} -p- {target}",shell=True,capture_output=False,check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
ports = ",".join(str(p) for p in open_ports)
|
||||||
else:
|
if subdomain:
|
||||||
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)
|
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):
|
if check and os.path.isfile(output):
|
||||||
print(f"nmap scan run correctly and saved to {output}")
|
print(f"nmap scan run correctly and saved to {output}")
|
||||||
|
else:
|
||||||
|
print("Install Nmap for a more detailed scan !")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global services,threads,rapport
|
global services,threads,rapport
|
||||||
@@ -642,14 +650,15 @@ def main():
|
|||||||
except socket.error:
|
except socket.error:
|
||||||
print("Unable to resolve target.")
|
print("Unable to resolve target.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
os.chdir(SCANFOLDER)
|
||||||
if not os.path.isdir(target):
|
if not os.path.isdir(target):
|
||||||
os.makedirs(target)
|
os.makedirs(target)
|
||||||
os.chdir(target)
|
os.chdir(target)
|
||||||
print(f"IP: {ip}")
|
print(f"IP: {ip}")
|
||||||
rapport.append(f"Scanning {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)
|
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.append("\nTCP OPEN PORTS:")
|
||||||
rapport += [f"{port}/TCP" for port in open_ports_tcp]
|
rapport += [f"{port}/TCP" for port in open_ports_tcp]
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
requests
|
||||||
Reference in new issue
Block a user