mirror of
https://github.com/aljazceru/recon-pipeline.git
synced 2025-12-19 07:14:23 +01:00
added config.py; refactored masscan a bit
This commit is contained in:
2
recon/config.py
Normal file
2
recon/config.py
Normal file
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@ from luigi.util import inherits
|
||||
from luigi.contrib.external_program import ExternalProgramTask
|
||||
|
||||
from recon.targets import TargetList
|
||||
from recon.config import top_tcp_ports, top_udp_ports
|
||||
|
||||
|
||||
@inherits(TargetList)
|
||||
@@ -19,15 +20,24 @@ class Masscan(ExternalProgramTask):
|
||||
self.masscan_output = f"masscan.{self.target_file}.json"
|
||||
|
||||
def requires(self):
|
||||
if self.ports and self.top_ports:
|
||||
logging.error("Only --ports or --top-ports is permitted, not both.")
|
||||
raise SystemExit
|
||||
return {"target_list": TargetList(target_file=self.target_file)}
|
||||
|
||||
def output(self):
|
||||
return luigi.LocalTarget(self.masscan_output)
|
||||
|
||||
def program_args(self):
|
||||
if self.ports and self.top_ports:
|
||||
logging.error("Only --ports or --top-ports is permitted, not both.")
|
||||
raise SystemExit
|
||||
|
||||
if self.top_ports:
|
||||
# if --top-ports used, format the top_*_ports lists as strings and then into a proper masscan --ports option
|
||||
top_tcp_ports_str = ",".join(str(x) for x in top_tcp_ports)
|
||||
top_udp_ports_str = ",".join(str(x) for x in top_udp_ports)
|
||||
|
||||
self.ports = f"{top_tcp_ports_str},U:{top_udp_ports_str}"
|
||||
self.top_ports = ""
|
||||
|
||||
command = [
|
||||
"masscan",
|
||||
"-v",
|
||||
@@ -39,8 +49,8 @@ class Masscan(ExternalProgramTask):
|
||||
self.interface,
|
||||
"-oJ",
|
||||
self.masscan_output,
|
||||
"--top-ports",
|
||||
self.top_ports,
|
||||
"--ports",
|
||||
self.ports,
|
||||
"-iL",
|
||||
self.input().get("target_list").path,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user