Metasploit mailing list archives

Re: How to call Console::UI from MSF plugin


From: eski mo <eskimo.ganges () gmail com>
Date: Wed, 7 Apr 2010 23:16:45 +0530

Thanx  , that helped , but i still need to do run_single(command) from
plugin. Did following but no joy, so far ..

BTW http://www.metasploit.com/redmine/projects/framework/wiki/DeveloperGuide_02
says following
"Shell (sub head)
......
To use the shell, a call must be made to the shell instance’s run
method. This method accepts either a block context, which will be
passed line-based input strings, or will operate in a callback mode
where a call is made to the run single method on the shell instance.
If the second method is used, the class is intended to be overridden
with a custom implementation of the run single method."

I tried

msf>irb
[*] Starting IRB shell...
myptr = Rex::Ui::Text::DispatcherShell.new('','>')
NoMethodError: undefined method `new' for Rex::Ui::Text::DispatcherShell:Module
....

but there exists a method in this class called new.
if i can create an instance, then i can call method run_single() in
the same class

why is the method not visible?

-eskiIVI0




On Mon, Apr 5, 2010 at 4:11 AM,  <egypt () metasploit com> wrote:
First, a resource file is not a plugin.  If really want a plugin,
there are several good examples in the plugins/ directory;
auto_add_route, db_credcollect, event_tester, and screenshoter all
show how to run code for every new session.  If you want to run an
exploit when a session is created, the best way is probably to do
something like the following:

mod = framework.exploits['windows/smb/ms08_067_netapi'].new
mod.datastore['LPORT'] = '4444'
...
mod.exploit_simple ...


Examples for using the exploit_simple method are plentiful.
auxiliary/server/browser_autopwn is one.

Hope this helped,
egypt


On Sun, Apr 4, 2010 at 9:21 AM, eski mo <eskimo.ganges () gmail com> wrote:
Thanx HD, But , my query is still unsolved. I want to call the
interactive commands from my plugin (say run_me_baby.rc ,placed at
msf3/plugin folder). What you're telling me is the executing of ruby
code by ./msfconsole (correct if wrong). I only want to know which
module to call frm inside my plugin say run_me_baby.rc.

If you call interactive commands (interact, sessions -i, etc) from the
Ruby code, keep in mind the ruby will keep executing when it returns.
You can mix multiple ruby blocks with inline commands in RC scripts.

in that case how to kill the code (running in memory).

I short my query is to execute the following codes from inside my
plugin say run_me_baby.rc. .

"use windows/smb/ms08_067_netapi
 set LHOST 192.168.1.1
set LPORT 12345
set PAYLOAD something
exploit -j"

just wanna do this.


regards
eskiIVI0
_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework



_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework


Current thread: