diff --git a/configs/local.yml b/configs/local.yml index 4bb05be..047601b 100644 --- a/configs/local.yml +++ b/configs/local.yml @@ -1,5 +1,13 @@ # Do not store sensitive information and check-in code to gitlab +report: + title: "Attack Surface Management Report" + author: "John Doe" + date: "2024-09-30" + header: "Confidential - For Internal Use Only" + footer: "Company XYZ - All Rights Reserved" + format: "pdf" + workflow: - workflowName: 'default' schedule: 'daily between 00:00 and 04:00' @@ -84,6 +92,14 @@ workflow: tools: ['Cloudflare'] order: 1 + - workflowName: 'testreport' + schedule: 'daily between 00:00 and 04:00' + cmd: [] + workflowConfig: + - moduleName : discovery + tools: ['Subfinder'] + order: 1 + nuclei_template_path: whitelist: blacklist: @@ -161,4 +177,4 @@ logging_debug: root: level: DEBUG - handlers: [console] \ No newline at end of file + handlers: [console] diff --git a/mantis/config_parsers/config_models.py b/mantis/config_parsers/config_models.py index 2b8b8df..c4a16e8 100644 --- a/mantis/config_parsers/config_models.py +++ b/mantis/config_parsers/config_models.py @@ -49,6 +49,7 @@ class NucleiTemplate(BaseModel): blacklist: str = Field(None) class AppConfig(BaseModel): + report: dict workflow: List[Workflow] dbConfig: DBConfig logging: dict @@ -57,4 +58,4 @@ class AppConfig(BaseModel): app: dict nuclei_template_path: NucleiTemplate aws: AWSConfig - \ No newline at end of file + diff --git a/mantis/models/args_model.py b/mantis/models/args_model.py index 806dd9a..b4a67ad 100644 --- a/mantis/models/args_model.py +++ b/mantis/models/args_model.py @@ -21,10 +21,11 @@ class ArgsModel(BaseModel): subdomain: str = Field(None) list_: bool = False list_orgs: bool = False + report_: bool = False list_domains: bool = False orgs_list: list[str] = False asset_types_list: list[str] = False after_datetime_filter: str = None before_datetime_filter: str = None in_scope: bool = False - \ No newline at end of file + diff --git a/mantis/utils/args_parse.py b/mantis/utils/args_parse.py index bf7a4cb..f6747b5 100644 --- a/mantis/utils/args_parse.py +++ b/mantis/utils/args_parse.py @@ -51,6 +51,13 @@ def list_msg(name=None): \033[0;32mmantis list {subcommand}\033[0m ''' + + @staticmethod + def report_msg(name=None): + return ''' + \033[1;34mREPORT:\033[0m + \033[0;32mmantis report -o example_org\033[0m + ''' @staticmethod def args_parse() -> ArgsModel: @@ -248,6 +255,13 @@ def args_parse() -> ArgsModel: list_parser.add_argument("-a","--after", type=str, help="Start date in YYYY-MM-DD format", dest="list_sub_command_ls_subs_after_filter") list_parser.add_argument("-b","--before", type=str, help="End date in YYYY-MM-DD format", dest="list_sub_command_ls_subs_before_filter") + report_parser = subparser.add_parser("report", help="Generate report", usage=ArgsParse.report_msg()) + + report_parser.add_argument('-o', '--org', + dest = 'org', + required = True, + help = "name of the organisation") + # display help, if no arguments are passed args = parser.parse_args(args=None if argv[1:] else ['--help']) logging.info(f"Arguments Passed - {args}") @@ -264,7 +278,7 @@ def args_parse() -> ArgsModel: parsed_args['input_type'] = "file" parsed_args['input'] = str(args.file_name) - if args.subcommand != "list": + if args.subcommand != "list" and args.subcommand != "report": if args.aws_profiles: parsed_args["aws_profiles"] = args.aws_profiles.split(',') @@ -320,6 +334,8 @@ def args_parse() -> ArgsModel: if args.list_sub_command_ls_orgs: parsed_args["list_orgs"] = True + if args.subcommand == "report": + parsed_args["report_"] = True # python launch.py list -d -s -t -o -a 2024-10-04 -b 2024-10-05 if args.list_sub_command_ls_domains: asset_types = [] @@ -344,4 +360,4 @@ def args_parse() -> ArgsModel: return args_pydantic_obj - \ No newline at end of file + diff --git a/mantis/workflows/mantis_workflow.py b/mantis/workflows/mantis_workflow.py index 5befd7c..4191a36 100644 --- a/mantis/workflows/mantis_workflow.py +++ b/mantis/workflows/mantis_workflow.py @@ -1,6 +1,7 @@ from mantis.models.args_model import ArgsModel from mantis.modules.workflow import Workflow from mantis.workflows.list_workflow import ListWorkflow +from mantis.workflows.report_workflow import ReportWorkflow import asyncio class MantisWorkflow: @@ -9,6 +10,8 @@ def select_workflow(args: ArgsModel) -> None: if args.list_: asyncio.run(ListWorkflow.executor(args)) + elif args.report_: + asyncio.run(ReportWorkflow.executor()) else: asyncio.run(Workflow.workflow_executor(args)) - \ No newline at end of file + diff --git a/mantis/workflows/report_workflow.py b/mantis/workflows/report_workflow.py new file mode 100644 index 0000000..0fe80b3 --- /dev/null +++ b/mantis/workflows/report_workflow.py @@ -0,0 +1,9 @@ +import logging +from mantis.config_parsers.config_client import ConfigProvider + +class ReportWorkflow: + + @staticmethod + async def executor(): + report = ConfigProvider.get_config().report + print(f"Report: {report}")