|
1 | 1 | # PYTHON_ARGCOMPLETE_OK |
2 | 2 | import sys |
3 | | -from termcolor import colored |
4 | 3 | from nxc.helpers.logger import highlight |
5 | | -from nxc.helpers.misc import identify_target_file, CATEGORY |
| 4 | +from nxc.helpers.misc import identify_target_file, display_modules |
6 | 5 | from nxc.parsers.ip import parse_targets |
7 | 6 | from nxc.parsers.nmap import parse_nmap_xml |
8 | 7 | from nxc.parsers.nessus import parse_nessus_file |
@@ -168,27 +167,11 @@ def main(): |
168 | 167 |
|
169 | 168 | # List low privilege modules |
170 | 169 | nxc_logger.highlight("LOW PRIVILEGE MODULES") |
171 | | - for category, color in {CATEGORY.ENUMERATION: "green", CATEGORY.CREDENTIAL_DUMPING: "cyan", CATEGORY.PRIVILEGE_ESCALATION: "magenta"}.items(): |
172 | | - # Add category filter for module listing |
173 | | - if args.list_modules and args.list_modules.lower() != category.name.lower(): |
174 | | - continue |
175 | | - if len([module for module in low_privilege_modules.values() if module["category"] == category]) > 0: |
176 | | - nxc_logger.highlight(colored(f"{category.name}", color, attrs=["bold"])) |
177 | | - for name, props in sorted(low_privilege_modules.items()): |
178 | | - if props["category"] == category: |
179 | | - nxc_logger.display(f"{name:<25} {props['description']}") |
| 170 | + display_modules(args, low_privilege_modules) |
180 | 171 |
|
181 | 172 | # List high privilege modules |
182 | 173 | nxc_logger.highlight("\nHIGH PRIVILEGE MODULES (requires admin privs)") |
183 | | - for category, color in {CATEGORY.ENUMERATION: "green", CATEGORY.CREDENTIAL_DUMPING: "cyan", CATEGORY.PRIVILEGE_ESCALATION: "magenta"}.items(): |
184 | | - # Add category filter for module listing |
185 | | - if args.list_modules and args.list_modules.lower() != category.name.lower(): |
186 | | - continue |
187 | | - if len([module for module in high_privilege_modules.values() if module["category"] == category]) > 0: |
188 | | - nxc_logger.highlight(colored(f"{category.name}", color, attrs=["bold"])) |
189 | | - for name, props in sorted(high_privilege_modules.items()): |
190 | | - if props["category"] == category: |
191 | | - nxc_logger.display(f"{name:<25} {props['description']}") |
| 174 | + display_modules(args, high_privilege_modules) |
192 | 175 | exit(0) |
193 | 176 | elif args.module and args.show_module_options: |
194 | 177 | for module in args.module: |
|
0 commit comments