Home page logo

metasploit logo Metasploit mailing list archives

Re: Wait notification state in meterpreter session
From: Michael Schierl <schierlm () gmx de>
Date: Tue, 30 Jul 2013 18:44:11 +0200

Am 30.07.2013 08:05, schrieb Anwar Mohamed:
I am developing for android payload in a java meterpreter session, I am
coding a call recorder where i want the metasploit user to start a
listener to listen for "getting new call" notification from the android
device "something like to start recieving call since we don't know when
will there will be a call and i don't want to use internal storage to
record calls" , so is there something like firing a background thread
for example to listen for specific TLV packet for example ?

The only way I can think of is using a custom channel type. When you
open a channel, you can set it to interact, which means that Metasploit
is informed asynchronously whenever something new happens on that
channel and a callback in your channel implementation is called. This is
normally used for things like shells or tunnelled network sockets.

Note that channels are byte based (just like TCP sockets or like
shells), so you'll have to more or less encode your events as text and
parse them from Ruby again.

On the Java side, a channel is implemented as a java.io.InputStream and
an optional java.io.OutputStream (if it is bidirectional) - so you will
need a custom InputStream subclass which will block until you got a new
call (use wait/notify here) and then return some "Getting new call
from..." message and continue blocking. You should also provide some way
to gracefully shutdown the stream so that it returns EOF (making the
channel return EOF and clean up everything).

Unless someone else who has a better understanding of the Ruby side of
Meterpreter stands up, I guess this is the best way to do it.



  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]