diff --git a/mantis/models/args_model.py b/mantis/models/args_model.py index d7673a4..82f6c83 100644 --- a/mantis/models/args_model.py +++ b/mantis/models/args_model.py @@ -18,4 +18,5 @@ class ArgsModel(BaseModel): delete_logs: bool = False verbose: bool = False thread_count: int = 3 + subdomain: str = Field(None) \ No newline at end of file diff --git a/mantis/modules/activehostscan/HTTPX.py b/mantis/modules/activehostscan/HTTPX.py index ed56351..7987c8b 100644 --- a/mantis/modules/activehostscan/HTTPX.py +++ b/mantis/modules/activehostscan/HTTPX.py @@ -76,6 +76,6 @@ def parse_report(self, outfile): async def db_operations(self, tool_output_dict, asset): await CrudUtils.update_asset(asset=asset, org=self.org, tool_output_dict=tool_output_dict) - if self.third_party_integrations: + if hasattr(self, 'third_party_integrations'): logging.debug("Inserting Third party integrations") await CrudUtils.insert_assets(self.third_party_integrations) diff --git a/mantis/utils/args_parse.py b/mantis/utils/args_parse.py index 5826bfd..a378b0e 100644 --- a/mantis/utils/args_parse.py +++ b/mantis/utils/args_parse.py @@ -215,6 +215,10 @@ def args_parse() -> ArgsModel: help = 'List of comma separated aws profiles for Route53', ) + scan_parser.add_argument('--sub', + dest = 'subdomain', + help='Subdomain to scan') + # display help, if no arguments are passed args = parser.parse_args(args=None if argv[1:] else ['--help']) @@ -270,6 +274,9 @@ def args_parse() -> ArgsModel: if args.thread_count: parsed_args["thread_count"] = args.thread_count + + if args.subdomain: + parsed_args["subdomain"] = args.subdomain args_pydantic_obj = ArgsModel.parse_obj(parsed_args) diff --git a/mantis/utils/tool_utils.py b/mantis/utils/tool_utils.py index a89b834..f848986 100644 --- a/mantis/utils/tool_utils.py +++ b/mantis/utils/tool_utils.py @@ -139,6 +139,10 @@ def get_pipeline(self, args): {"$match" : {"created_timestamp":{"$gte" : datetime.today().strftime('%Y-%m-%d')}}} ) + if args.subdomain: + pipeline.append( + {"$match" : {"asset" : args.subdomain}} + ) return pipeline