Home page logo
/

metasploit logo Metasploit mailing list archives

Re: How to call Console::UI from MSF plugin
From: HD Moore <hdm () metasploit com>
Date: Sun, 04 Apr 2010 09:42:02 -0500

On 4/4/2010 2:39 AM, eski mo wrote:
1. I think the main MSF API console commands like  use,exploit etc are
triggered by msf/ui/console . How do I call these  commands within my
plugin. The 'Automating the Metasploit Console'
(http://blog.metasploit.com/2010/03/automating-metasploit-console.html)
only provides automation just after msfconsole is fired. I want it at
the time of some triggered event (say arrival of session).

btw tried --- session.console.run_single(command)... dint worked :(

The code you are looking for is just:

$ cat test.rc
<ruby>
run_single("version")
run_single("quit")
</ruby>

hdm () ubuntu:/msf3$ ./msfconsole  -r test.rc
<snip>
[*] resource (test.rc)> Ruby Code (41 bytes)
Framework: 3.4.0-dev.8977
Console  : 3.4.0-dev.8809
hdm () ubuntu:/msf3$


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.

2. Can Meterpreter scripts call the main MSF UI console commands like
use,exploit etc. ?


No, by design they shouldn't. Messing with the user's console from a
payload script can lead to bad behavior.
_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework


  By Date           By Thread  

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