lmacken / pyrasite

Inject code into running Python processes

Home Page:http://pyrasite.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No response when using pyrasite-shell

mahmoud opened this issue · comments

Hey Luke/Pyrasite crew, I'm trying to attach a shell to a twisted process, and all i'm getting is a hung shell. So I SIGINT and rerun with a --verbose, like: pyrasite --verbose 14129 dump_modules.py and I see:

[Thread debugging using libthread_db enabled]
[New Thread 0x7fd91ed28700 (LWP 15516)]
[New Thread 0x7fd91f529700 (LWP 15515)]
[New Thread 0x7fd91fd2a700 (LWP 15514)]
[New Thread 0x7fd924a8b700 (LWP 14332)]
[New Thread 0x7fd92528c700 (LWP 14133)]
[New Thread 0x7fd925a8d700 (LWP 14130)]
0x00007fd92a82a163 in epoll_wait () from /lib/libc.so.6
$1 = PyGILState_UNLOCKED
$2 = 0


warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff075fe000

Waiting at an epoll, as one would expect from a Twisted process running on Debian:

# uname -a
Linux graybles 2.6.32-042stab079.6 #1 SMP Mon Aug 26 19:47:50 MSK 2013 x86_64 GNU/Linux

Also, I'm using the pip-installable versions of all relevant libraries. Let me know if there's anything else I can provide. And of course, thanks for making pyrasite as it is very awesome. :)

That output looks fine, does the helloworld.py payload work? I'll throw the latest debian in a VM and try and reproduce the issue.

Er, to reproduce this environment, I wouldn't go latest; this is still a 2.6 kernel. Latest would probably be yama'd, too, this one isn't.

And the payloads work, in that they don't dump a stack trace or anything, but they don't print anything unless I go verbose.

And it was as I typed the above that I remembered all my processes are running under supervisord. Checking my logs, I saw that the stuff was in fact going to the stdout of the target process, whereas I'd expected it to come out of the stdout of pyrasite. Is that indeed the intended behavior? Also, any advice for this sort of situation?

Yeah, that is the current behavior. It wouldn't be very difficult to tweak pyrasite to display stdout from the payloads, but the current payloads are dumb and spit things to stdout of the injected process.