From b9f7bab5f45f0611181c4151a71f87cf34677717 Mon Sep 17 00:00:00 2001 From: devplayer55221 Date: Mon, 14 Oct 2024 21:53:56 +0530 Subject: [PATCH] Added a flag for filtering Cloudflare records based on scope --- mantis/models/args_model.py | 1 + mantis/modules/dns/Cloudflare.py | 2 +- mantis/utils/args_parse.py | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mantis/models/args_model.py b/mantis/models/args_model.py index a843f946..ceb59bc3 100644 --- a/mantis/models/args_model.py +++ b/mantis/models/args_model.py @@ -21,4 +21,5 @@ class ArgsModel(BaseModel): subdomain: str = Field(None) list_: bool = False list_orgs: bool = False + in_scope: bool = False \ No newline at end of file diff --git a/mantis/modules/dns/Cloudflare.py b/mantis/modules/dns/Cloudflare.py index c1f9109b..3e89b223 100644 --- a/mantis/modules/dns/Cloudflare.py +++ b/mantis/modules/dns/Cloudflare.py @@ -60,7 +60,7 @@ async def main(self): records = cf.zones.dns_records.get(zone['id'], params={'per_page': per_page, 'page': record_page})['result'] for record in records: domain_dict = {} - if(self.args.ignore_stale == True): + if(self.args.in_scope == True): print(self.db_assets) for asset in self.db_assets: if(asset in record['name']): diff --git a/mantis/utils/args_parse.py b/mantis/utils/args_parse.py index 43916c25..061cb323 100644 --- a/mantis/utils/args_parse.py +++ b/mantis/utils/args_parse.py @@ -229,6 +229,12 @@ def args_parse() -> ArgsModel: scan_parser.add_argument('--sub', dest = 'subdomain', help='Subdomain to scan') + + scan_parser.add_argument('-is', '--in_scope', + dest = 'in_scope', + help = 'List only the records from nameserver that are in scope', + action = 'store_true' + ) list_parser = subparser.add_parser("list", help="List entities present in db", usage=ArgsParse.list_msg())