Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impacket: Error when running "example" scripts from the command line. #299206

Closed
vncsb opened this issue Mar 26, 2024 · 0 comments · Fixed by #300193
Closed

impacket: Error when running "example" scripts from the command line. #299206

vncsb opened this issue Mar 26, 2024 · 0 comments · Fixed by #300193

Comments

@vncsb
Copy link
Contributor

vncsb commented Mar 26, 2024

Describe the bug

When running various example scripts from the impacket package at the command line, we are faced with the following error, this example is running the psexec.py script:

[nix-shell:~]$ psexec.py
Traceback (most recent call last):
  File "/nix/store/clcl35gymxwz3iywwh5fnkzd3mcnlcml-python3.11-impacket-0.11.0/bin/.psexec.py-wrapped", line 34, in <module>
    from impacket import version, smb
  File "/nix/store/clcl35gymxwz3iywwh5fnkzd3mcnlcml-python3.11-impacket-0.11.0/lib/python3.11/site-packages/impacket/version.py", line 10, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Steps To Reproduce

Steps to reproduce the behavior:

  1. Get the master version of the impacket package:
nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz -p python3Packages.impacket
  1. Run any of the "example" scripts (psexec.py)

Expected behavior

When running psexec.py or other available scripts without arguments it should show us the help message.

Additional context

Some places of the impacket codebase uses the pkg_resources module of setuptools. As far as I understood, pkg_resources is used at runtime and in #281309 the setuptools dependence was moved to nativeBuildInputs leaving pkg_resources not acessible at runtime anymore. I have confirmed locally that adding setuptools back to propagatedBuildInputs fixes the error but I am not sure if this is the best approach.

Screenshots

psexec-error
No setuptools in the environment

psexec-success
Adding setuptools to the environment resolves the issue

Notify maintainers

@fabaff

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/2bk3cqpj26fi3fwgshgg3k0fxwz0h55g-nix-info
copying path '/nix/store/2bk3cqpj26fi3fwgshgg3k0fxwz0h55g-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.9-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

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

Successfully merging a pull request may close this issue.

1 participant