Skip to content

Refactor is_host_dc call based on file generation flags#1097

Open
mpgn wants to merge 4 commits intomainfrom
mpgn-patch-1
Open

Refactor is_host_dc call based on file generation flags#1097
mpgn wants to merge 4 commits intomainfrom
mpgn-patch-1

Conversation

@mpgn
Copy link
Collaborator

@mpgn mpgn commented Feb 6, 2026

Conditionally call is_host_dc based on arguments for generating files.

Description

This pull request introduces a small but important change to the logic for determining whether to call the is_host_dc() method in the enum_host_info function in nxc/protocols/smb.py. The update ensures that is_host_dc() is only called under specific conditions related to the generation of hosts or krb5 files.

Key logic update:

  • The call to is_host_dc() is now conditioned to only run if either generate_hosts_file or generate_krb5_file arguments are set, or if neither is set, ensuring more precise control over when domain controller detection occurs. [1] [2]

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

Screenshots (if appropriate):

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)

Conditionally call is_host_dc based on arguments for generating files.

Signed-off-by: mpgn <5891788+mpgn@users.noreply.github.com>
Signed-off-by: mpgn <5891788+mpgn@users.noreply.github.com>
@mpgn
Copy link
Collaborator Author

mpgn commented Feb 7, 2026

should be better @NeffIsBack !

mpgn added 2 commits February 8, 2026 10:51
Change isdc initialization from False to None and update related checks.

Signed-off-by: mpgn <5891788+mpgn@users.noreply.github.com>
Signed-off-by: mpgn <5891788+mpgn@users.noreply.github.com>
@mpgn
Copy link
Collaborator Author

mpgn commented Feb 8, 2026

done, let me know what you think @NeffIsBack :)

Copy link
Member

@NeffIsBack NeffIsBack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's go with this👍

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants