lmacken / pyrasite

Inject code into running Python processes

Home Page:http://pyrasite.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ipc.connect hang forever

allan-simon opened this issue · comments

I'm trying to hook on a old python process using pyrasite-shell , and it does not work, it hangs forever and when I finally CTRL+C I got the following stack-trace :

admin@x:~$ sudo pyrasite-shell 476 

^CTraceback (most recent call last):
  File "/usr/local/bin/pyrasite-shell", line 11, in <module>
    sys.exit(shell())
  File "/usr/local/lib/python2.7/dist-packages/pyrasite/tools/shell.py", line 30, in shell
    ipc.connect()
  File "/usr/local/lib/python2.7/dist-packages/pyrasite/ipc.py", line 95, in connect
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/pyrasite/ipc.py", line 151, in wait
    (clientsocket, address) = self.server_sock.accept()
  File "/usr/lib/python2.7/socket.py", line 202, in accept
    sock, addr = self._sock.accept()
KeyboardInterrupt

on a similar but "recently" launched process , I can get a shell

Most likely, your injection is not working and therefore the injected code isn't calling back to your 'remote' shell.

If you add a verbose=True to this call (third parameter), you may get a more useful error message. For me, I 1) needed to install gdb and 2) was trying to run pyrasite in a docker container and needed to give it the PTRACE capability.

I had a similar problem, i wasn't the same user as the process, downgrading to that user fixed it (from root)