calebstewart/pwncat

[BUG] Paramiko for not installing with setup.py

calebstewart opened this issue · 10 comments

Describe the bug
For some reason, python does not always install the paramiko fork referenced in setup.py. This causes people to have an argument error when connecting via SSH. To mitigate this, I've added a runtime check with inspect as a mitigation until the problem is fixed. The mitigation will tell the user how to fix the problem (which is one simple pip command).

If you have an older version of pwncat and run an ssh connection without the correct paramiko version you will get a message like this:

TypeError: recv() takes 2 positional arguments but 3 were given

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to connect to a target with SSH.

Expected behavior
A successful connection.

Unable to start a listener and get an error pwncat requires a custom fork of paramiko. This can be installed with pip install -U __main__.py:23 git+https://github.com/calebstewart/paramiko.

Tried installing paramiko but still does not work. Even after that I still get the same error

Did you run exactly you sent above? It looks like your terminal word-wrapped which caused a filename to appear in the middle of the output. The command needed to install paramiko should be pip install -U git+https://github.com/calebstewart/paramiko. If that doesn't work, can you try first removing paramiko and then running the install? If that works, I will modify the message to account for that. When I tested locally, including the -U would replace the installed mainstream version, but it's possible you're seeing something different.

I ran the commands in the following order:

sudo pip3 install git++https://github.com/calebstewart/pwncat.git

But then when I ran pwncat, I got the above error related to paramiko. So, I then ran the command:
sudo pip3 uninstall paramiko
sudo pip3 install git+https://github.com/calebstewart/paramiko

But even after that, I get the same error related to paramiko.

Did you install pwncat with sudo python setup.py install? If you installed pwncat in a virtual environment as detailed in the documentation, you shouldn't be using sudo pip3 install, because that is changing your global packages and doesn't effect your virtual environment. You should enter your virtual environment (./path/to/virtualenv/bin/activate) then just do pip install -U git+https://github.com/calebstewart/paramiko. I just tested this with a fresh clone and fresh virtual environment and it worked.

Okay, this time I ran the commands as:

  1. python3 -m venv pwncat-venv
  2. source pwncat-venv/bin/activate
  3. pip install git+https://github.com/calebstewart/pwncat.git
  4. pip install -U git+https://github.com/calebstewart/paramiko

And it worked! Thanks!!!
But what should I do if I want to install it as tool on my system itself?

Binaries installed within a virtual environment understand that they are part of a virtual environment, so after setting up your virtual environment, you can symlink the pwncat executable to your personal bin directory (or the system bin directory, if other users have access to your virtual environment). I do this:

python -m venv env
. env/bin/activate
python setup.py install
ln -s $PWD/env/bin/pwncat $HOME/.local/bin/

And then pwncat is available even when you haven't "activated" your virtual environment and will still use the virtual environment specific modules.

I'll do this then. Thank you soo much for the guidance!

peek1 commented

solution that worked for me
sudo pip uninstall paramiko
sudo pip install -U git+https://github.com/calebstewart/paramiko

Okay, this time I ran the commands as:

1. `python3 -m venv pwncat-venv`

2. `source pwncat-venv/bin/activate`

3. `pip install git+https://github.com/calebstewart/pwncat.git`

4. `pip install -U git+https://github.com/calebstewart/paramiko`

And it worked! Thanks!!!
But what should I do if I want to install it as tool on my system itself?

thanks it worked for me too

This worked for me:

sudo pip uninstall paramiko
sudo pip install -U git+https://github.com/calebstewart/paramiko