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