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

distutils not found #289

Open
VainXploits opened this issue Oct 4, 2024 · 3 comments
Open

distutils not found #289

VainXploits opened this issue Oct 4, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@VainXploits
Copy link

Bug Description

After installing pwncat using pip, facing an issue saying distutils not found

pwncat version

Can't provide version because I can't run pwncat-cs because distutils is not found

Target System (aka "victim")

My own kali box

┌──(root㉿vain)-[~]
└─# pwncat-cs -lp 4444                            
Traceback (most recent call last):
  File "/usr/local/bin/pwncat-cs", line 5, in <module>
    from pwncat.__main__ import main
  File "/usr/local/lib/python3.12/dist-packages/pwncat/__main__.py", line 11, in <module>
    import pwncat.manager
  File "/usr/local/lib/python3.12/dist-packages/pwncat/manager.py", line 43, in <module>
    import zodburi
  File "/usr/local/lib/python3.12/dist-packages/zodburi/__init__.py", line 2, in <module>
    from pkg_resources import iter_entry_points
  File "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py", line 90, in <module>
    import packaging.markers
  File "/usr/local/lib/python3.12/dist-packages/packaging/markers.py", line 25, in <module>
    from .specifiers import InvalidSpecifier, Specifier
  File "/usr/local/lib/python3.12/dist-packages/packaging/specifiers.py", line 14, in <module>
    from .utils import canonicalize_version
  File "/usr/local/lib/python3.12/dist-packages/packaging/utils.py", line 9, in <module>
    from .tags import Tag, parse_tag
  File "/usr/local/lib/python3.12/dist-packages/packaging/tags.py", line 7, in <module>
    import distutils.util
ModuleNotFoundError: No module named 'distutils'

Above is the error that pops up whenever pwncat-cs is run with any flag after it.

@VainXploits VainXploits added the bug Something isn't working label Oct 4, 2024
@scmanjarrez
Copy link

scmanjarrez commented Oct 6, 2024

This is a problem with latest python version in kali (3.12).
If you have a previous python version, then you can try installing setuptools and see if that fixes the problem for you.

pip install setuptools

If your python version is 3.12, then you'll need to do some manual updates:
First, install a pwncat with the new setuptools changes

pip install --force-reinstall git+https://github.com/scmanjarrez/pwncat

Next you need to update a pwncat dependency with the changes applied for setuptools

pip install git+https://github.com/Pylons/zodburi@modernize-python-versions

Pip will complain but ignore it, by this time pwncat should work again

❯ pwncat-cs -l -p 8000
/home/kali/htb/machines/hard/Yummy/venv/lib/python3.12/site-packages/paramiko/pkey.py:158: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  'cipher': algorithms.TripleDES,
/home/kali/htb/machines/hard/Yummy/venv/lib/python3.12/site-packages/paramiko/transport.py:178: CryptographyDeprecationWarning: Blowfish has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.Blowfish and will be removed from this module in 45.0.0.
  'class': algorithms.Blowfish,
/home/kali/htb/machines/hard/Yummy/venv/lib/python3.12/site-packages/paramiko/transport.py:202: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  'class': algorithms.TripleDES,
Ignoring index for /home/kali/htb/machines/hard/Yummy/pwncat/db/pwncat
[12:38:40] Welcome to pwncat 🐈!                                                                                                                                                                                                __main__.py:164
bound to 0.0.0.0:8000

The warnings apparently can be removed by removing paramiko-ng and installing paramiko package instead. P.S: Haven't tested enough to confirm that this is an in-place replacement.

@nikallass
Copy link

Hi all.

  1. to fix "No module named 'distutils'" error - add setuptools = "^70.0" to pyproject.toml in [tool.poetry.dependencies] section;
  2. to fix "TripleDES \ Blowfish warnings" add cryptography = "^36.0.0" to pyproject.toml in [tool.poetry.dependencies] section;
  3. use pipx install /path/to/pwncat/cloned/git/dir.

@sagisar1
Copy link

Hi, I Have the same problem, because I am using kali linux with python 3.12, and unfortunately, python 3.11 or 3.10 in which distutils wasn't deprecated yet, is not available in kali linux directly.

installing setuptools doesn't fix the problem.

anyway , since the author says in the README file of the tool:

pwncat requires Python 3.9+ on Linux

I suggest replacing distutils with something that works along all python3.9+ versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants