rapid7 / metasploit-payloads

Unified repository for different Metasploit Framework payloads
Other
1.74k stars 671 forks source link

Request: meterpreter python real time output #123

Open s3c opened 8 years ago

s3c commented 8 years ago

Currently the meterpreter python module only returns script output after the script has finished. This limits the use of background scripts, which could open up possibilities like searching for files/hosts while working on a session, and investigating any that are found, without having to wait a long time for the output. For example, when running the following script:

import time print("before delay") time.sleep(5) print("after delay 1") time.sleep(5) print("after delay 2")

The output below is returned all at once after the script has completed:

meterpreter > python_import -f /root/testscript.py [*] Importing /root/testscript.py ... [+] Content written to stdout: before delay after delay 1 after delay 2

The ideal would be if output was returned in real time as delivered by the script. This was tested on metasploit 4.12.25-dev and stock Kali.

OJ commented 8 years ago

What you're asking for is a full channelised python prompt, which isn't a trivial amount of work. Part of my concern with this is that if I implement a rudimentary version of it, the next set of bug reports will be "why doesn't the prompt function like my local Python install?" and "can I get tab completion?".

Give a mouse a cookie ;)

I'll think about this a little though.

s3c commented 8 years ago

I appreciate you looking at this OJ, I understand that it probably won't be trivial and might not be worth the effort from your side. It would be pretty slick though :)

OJ commented 8 years ago

I agree. I'd love to give people a lot of features and a lovely interactive prompt. But it's quite a tricky job to make it "good" :)