Error message help for python_pty_shell (used in ippsec's walkthrough of machine: popcorn)

Hi all,

I am currently learning various things as I have a go at popcorn.

I followed ippsec’s walkthrough to get an interactive python shell (my exact steps detailed below if needed but although I can only post two links as a new user it is from 14 minutes exactly in ippsec’s walkthrough of popcorn).

In short, I edited the lhost in tcp_pty_backconnect.py (https://raw.githubusercontent.com/infodox/python-pty-shells/master/tcp_pty_backconnect.py) to my ip address, then uploaded it to dev/shm/.rev.py on popcorn.

Then I started up the python listener with:

python tcp_pty_shell_handler.py -b :31337

(link to the python listener file: https://raw.githubusercontent.com/infodox/python-pty-shells/master/sctp_pty_shell_handler.py - it is this file that is returning the error I need help with.)

Then, when I tun tcp_pty_backconnect.py,on popcorn, I get the following error message from tcp_pty_shell_handler on my machine:

Traceback (most recent call last):
File “/opt/shell/python-pty-shells/tcp_pty_shell_handler.py”, line 163, in
s.handle()
File “/opt/shell/python-pty-shells/tcp_pty_shell_handler.py”, line 78, in handle
pty = PTY()
File “/opt/shell/python-pty-shells/tcp_pty_shell_handler.py”, line 16, in init
self.pty = open(os.readlink(“/proc/%d/fd/%d” % (pid, slave)), “rb+”)
io.UnsupportedOperation: File or stream is not seekable.
Exception ignored in: <function PTY.del at 0x7f588699bbe0>
Traceback (most recent call last):
File “/opt/shell/python-pty-shells/tcp_pty_shell_handler.py”, line 56, in del
self.termios.tcsetattr(self.pty, self.termios.TCSAFLUSH, self.oldtermios)
AttributeError: ‘PTY’ object has no attribute ‘pty’

Can anyone help me figure out this error message and what I need to do differently to make this work?
Hopefully I have provided enough information for somebody to help me make sense of this!

Thanks in advance.

It appears that you are encountering an error while trying to set up the interactive python shell using the provided scripts and instructions. The error message indicates an issue with the “tcp_pty_shell_handler.py” file. Here are a few things you can try to resolve the error:

Verify File Integrity: Ensure that the “tcp_pty_shell_handler.py” file was downloaded and uploaded correctly without any corruption or modifications.

Check File Permissions: Make sure that the “tcp_pty_shell_handler.py” file has appropriate permissions to be executed. You can use the “chmod” command to adjust the file permissions if needed.

Update Python Dependencies: Ensure that you have the necessary dependencies and versions required by the script. Check if any additional packages need to be installed or if there are any compatibility issues.

Double-check IP Addresses: Verify that you correctly edited the IP address in the “tcp_pty_backconnect.py” file to match your own IP address.

Debugging: To get more information about the error, you can add print statements or use a debugger to identify the exact line causing the issue in the “tcp_pty_shell_handler.py” file.

Seek Support: Consider reaching out to the developer of the scripts or the community where you found them for assistance. They may have specific troubleshooting steps or insights based on their experience.

Keep in mind that working with such scripts and configurations requires a good understanding of the underlying technologies and security implications. Ensure that you have the necessary permissions and legal authorization to perform these activities in your environment.

Regards,
Rachel Gomez