Jul 22, 2011

Metasploit Console Customizable Prompts

The Metasploit Console now supports customizable prompts similar to how bash has the PS1 variable. To set a custom prompt the setg command can be used to set the Prompt variable. For example:

msf > setg Prompt "%T - (Sessions: %S Jobs: %J) "
Thu Jul 21 02:25:43 -0400 2011 - (Sessions: 0 Jobs: 0) >

This command will result in the timestamp, session count and job counts to be displayed within the prompt. The following variables are available for customizable prompts:

Variables:
%T - Timestamp
%S - Session count
%J - Job count
%H - Hostname of the local machine
%U - Username of the user running msfconsole
%D - Current local directory
%L - Host to use for listeners (same as 0.0.0.0)

Timestamps:
Setting a timestamp will initially result in using the default ruby format.
ie. Thu Jul 21 02:25:27 -0400 2011. To alter the formatting of a timestamp
set the PromptTimeFormat variable. For a list of time format options check out the Time class documentation for the strftime function (http://www.ruby-doc.org/core/classes/Time.html#M000392). Here is an example of using the PromptTimeFormat variable to change the timestamp formatting.

setg PromptTimeFormat "%I:%H:%S"
PromptTimeFormat => %I:%H:%S
03:03:00

Additionally, the ending character of the prompt is also configurable. Set the PromptChar variable to change the ending character from the default '>' character.

msf > setg PromptChar "#"
msf #

Once a suitable prompt has been configured the save command will write the global setting to the config file.

setg Prompt "%cya%T%clr - %L (s:%red%S%clr j:%red%J%clr) msf "
Prompt => %T - %L (s:%S j:%J) msf
10:21:51 - 192.168.0.111 (s:0 j:0) msf > save
Saved configuration to: /Users/bannedit/.msf3/config




If you like my blog, Please Donate Me

No comments:

 

Sponsors

lusovps.com

Blogroll

About

 Please subscribe my blog.

 Old Subscribe

Share |