Skip to content

Conversation

@Mauriceter
Copy link
Contributor

@Mauriceter Mauriceter commented Oct 10, 2025

Description

This PR add handling for using aliases when using multiple module.

Aliases are defined in nxc.conf, I have added the following aliases as example in the default config file:

[aliases]
dc-vuln = -M zerologon -M nopac
serv-vuln = -M ntlm_reflection -M printnightmare -o PORT=445 -M ms17-010 -M smbghost -M webdav 

Default aliases for credential dumping could also be added for example.

Aliases are then expand to sys.argv before modules are treated so it should be compatible with the module parsing rework in PR: #931

The PR introduces a new argument -A/--aliases to call aliases multiple -A can be used and a combination of -A and -M is possible. Alias processing is done in nxc/loaders/aliasloader.py

I plan to add an -L equivalent for aliases.

Should I use a new arg group for aliases instead of the module group?

Type of change

Insert an "x" inside the brackets for relevant items (do not delete options)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Deprecation of feature or functionality
  • This change requires a documentation update
  • This requires a third party update (such as Impacket, Dploot, lsassy, etc)

Setup guide for the review

  • Create aliases in the nxc.conf
  • Call them using -A argument like: poetry run netexec smb DC.sccm.lab -u alice -p whiteRabbit -A serv-vuln -A dc-vuln -M ntlmv1

Screenshots (if appropriate):

Example of scan on a DC without having to had a lot of -M arguments.

image

Checklist:

Insert an "x" inside the brackets for completed and relevant items (do not delete options)

  • I have ran Ruff against my changes (via poetry: poetry run python -m ruff check . --preview, use --fix to automatically fix what it can)
  • I have added or updated the tests/e2e_commands.txt file if necessary (new modules or features are required to be added to the e2e tests)
  • New and existing e2e tests pass locally with my changes
  • If reliant on changes of third party dependencies, such as Impacket, dploot, lsassy, etc, I have linked the relevant PRs in those projects
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (PR here: https://github.com/Pennyw0rth/NetExec-Wiki)

@Mauriceter
Copy link
Contributor Author

Added the --list-aliases option:

image

Should I move this option to the main parser since it doesn't need a protocol?

@Mauriceter Mauriceter marked this pull request as ready for review October 10, 2025 13:59
@NeffIsBack
Copy link
Member

Interesting idea, thanks for the PR!

There were quite some discussion in the past how to solve that problem and this might be a good solution. However, i don't think we need a separate loader for that and neither should we use/manipulate sys.argv. I will get back to this when the module refactor is done and then take a deeper look at how we could implement it. Also because it will be highly influenced on how the refactor turns out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants