The msfwx user interface is now obsolete, further GUI work will be handled by msfgui/msfgtk2

git-svn-id: file:///home/svn/framework3/trunk@4409 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2007-02-17 23:54:09 +00:00
parent 854607771c
commit 149987b41e
15 changed files with 0 additions and 4481 deletions

Binary file not shown.

View File

@ -1,26 +0,0 @@
/* XPM */
static char * encoders_xpm[] = {
"16 16 7 1",
" c None",
". c #000000",
"+ c #A0A0A4",
"@ c #C0C0C0",
"# c #808080",
"$ c #585858",
"% c #303030",
" ",
" ",
" ",
" ... ",
" ..+++.. ",
" ..+++@+++.. ",
"..+++@+++++++.. ",
".#+++++++++++$. ",
".###+++++++$$$. ",
"..####+++$$$$.. ",
"% ..####$$$.. % ",
" % ..##$.. % ",
" % ... % ",
" % % ",
" ",
" "};

Binary file not shown.

View File

@ -1,105 +0,0 @@
/* XPM */
static char * mod_exploit_xpm[] = {
"16 15 87 1",
" c None",
". c #F21B00",
"+ c #EF1B00",
"@ c #F22407",
"# c #ED2307",
"$ c #F74626",
"% c #F34E31",
"& c #E41800",
"* c #EF1E02",
"= c #FD7854",
"- c #E21B02",
"; c #F23B1D",
"> c #FE6437",
", c #EA3C22",
"' c #E42D15",
") c #FE1F00",
"! c #FB1E00",
"~ c #F81D00",
"{ c #F52406",
"] c #F33215",
"^ c #F03115",
"/ c #FB714E",
"( c #FA7655",
"_ c #E12D15",
": c #DE2C15",
"< c #D51B06",
"[ c #D5230E",
"} c #C61100",
"| c #C31000",
"1 c #FD1F00",
"2 c #FB4527",
"3 c #FE7F5F",
"4 c #FE734D",
"5 c #FE5E32",
"6 c #FE6E46",
"7 c #FB6A49",
"8 c #D92812",
"9 c #C20F00",
"0 c #F52203",
"a c #FD5932",
"b c #FE5228",
"c c #FE5229",
"d c #FB4C29",
"e c #CF1703",
"f c #EF2508",
"g c #FA3C16",
"h c #FE471E",
"i c #FE4720",
"j c #F33C1C",
"k c #D11602",
"l c #EA1E02",
"m c #FE3D15",
"n c #FE3D17",
"o c #D51803",
"p c #F0573E",
"q c #EF2103",
"r c #FE340E",
"s c #FE330E",
"t c #DC1B04",
"u c #EA3A20",
"v c #F32203",
"w c #FE2C08",
"x c #FE2909",
"y c #F82508",
"z c #F82607",
"A c #FE2B08",
"B c #E71C04",
"C c #BF0F00",
"D c #E72E15",
"E c #FA2102",
"F c #FB1F03",
"G c #E21801",
"H c #CF1300",
"I c #CB1100",
"J c #DB1601",
"K c #FB2203",
"L c #F71F03",
"M c #BC0E00",
"N c #E11902",
"O c #EA1700",
"P c #D61400",
"Q c #C51000",
"R c #DC1400",
"S c #BE0E00",
"T c #D91500",
"U c #BB0D00",
"V c #B70D00",
" .+ ",
" @# ",
" +$%& ",
" *==- ",
" ;>>,' ",
")!~{]^/>>(_:<[}|",
"1234455555564789",
" 0abbbbbbbcde ",
" fghhhhhijk ",
" lmmmmmno ",
" pqrrsrrst ",
" uvwxyzAwBC ",
" DEFGHIJKLM ",
" NOP QRS ",
" TP UV "};

View File

@ -1,108 +0,0 @@
/* XPM */
static char * mod_exploit_xpm[] = {
"16 15 90 1",
" c None",
". c #F27A00",
"+ c #EF7700",
"@ c #F28807",
"# c #ED8307",
"$ c #EF7800",
"% c #F7B526",
"& c #F3B131",
"* c #E46B00",
"= c #EF7E02",
"- c #FDF554",
"; c #FDF354",
"> c #E27002",
", c #F2A31D",
"' c #FEFE37",
") c #EA9722",
"! c #E48215",
"~ c #FE8A00",
"{ c #FB8800",
"] c #F88300",
"^ c #F58C06",
"/ c #F39715",
"( c #F09215",
"_ c #FBEA4E",
": c #FAE755",
"< c #E17F15",
"[ c #DE7C15",
"} c #D56406",
"| c #D56B0E",
"1 c #C64A00",
"2 c #C34600",
"3 c #FD8900",
"4 c #FBAE27",
"5 c #FEF05F",
"6 c #FEF74D",
"7 c #FEF732",
"8 c #FEF746",
"9 c #FBDC49",
"0 c #D97612",
"a c #C24400",
"b c #F58E03",
"c c #FDE232",
"d c #FEE528",
"e c #FEE129",
"f c #FBC629",
"g c #CF5C03",
"h c #EF8808",
"i c #FAC216",
"j c #FED61E",
"k c #FECF20",
"l c #F3A91C",
"m c #D15C02",
"n c #EA7F02",
"o c #FEC615",
"p c #FEBF17",
"q c #D56103",
"r c #F0AE3E",
"s c #EF8803",
"t c #FEB70E",
"u c #FEB50E",
"v c #FEB40E",
"w c #DC6A04",
"x c #EA9320",
"y c #F38D03",
"z c #FEA708",
"A c #FE9709",
"B c #F88808",
"C c #F89307",
"D c #FEA608",
"E c #E77104",
"F c #BF4200",
"G c #E78515",
"H c #FA8E02",
"I c #FB8203",
"J c #E26601",
"K c #CF5300",
"L c #CB4E00",
"M c #DB6001",
"N c #FB8C03",
"O c #F77E03",
"P c #BC3E00",
"Q c #E16A02",
"R c #EA6900",
"S c #D65A00",
"T c #C54600",
"U c #DC5900",
"V c #BE3E00",
"W c #D95F00",
"X c #BB3C00",
"Y c #B73800",
" .+ ",
" @# ",
" $%&* ",
" =-;> ",
" ,'')! ",
"~{]^/(_'':<[}|12",
"345667777778690a",
" bcdddddddefg ",
" hijjjjjklm ",
" nooooopq ",
" rsttuttvw ",
" xyzABCDzEF ",
" GHIJKLMNOP ",
" QRS TUV ",
" WS XY "};

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
/* XPM */
static char * msf_xpm[] = {
"32 32 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" .... .... ",
" .... .... ",
" ..... .... ",
" .... ..... ",
" .... .... ",
" ................... ",
" ................... ",
" ................... ",
" .................. ",
" .... .... ",
" .... .... ",
" .... .... ",
" ................... ",
" ................... ",
" .................. ",
" .................. ",
" ..... .... ",
" .... ..... ",
" .... .... ",
" .... .... ",
" .... .... ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,26 +0,0 @@
/* XPM */
static char * encoders_xpm[] = {
"16 16 7 1",
" c None",
". c #000000",
"+ c #A0A0A4",
"@ c #C0C0C0",
"# c #808080",
"$ c #585858",
"% c #303030",
" ",
" ",
" ",
" ... ",
" ..+++.. ",
" ..+++@+++.. ",
"..+++@+++++++.. ",
".#+++++++++++$. ",
".###+++++++$$$. ",
"..####+++$$$$.. ",
"% ..####$$$.. % ",
" % ..##$.. % ",
" % ... % ",
" % % ",
" ",
" "};

View File

@ -1,26 +0,0 @@
/* XPM */
static char * encoders_xpm[] = {
"16 16 7 1",
" c None",
". c #000000",
"+ c #A0A0A4",
"@ c #C0C0C0",
"# c #808080",
"$ c #585858",
"% c #303030",
" ",
" ",
" ",
" ... ",
" ..+++.. ",
" ..+++@+++.. ",
"..+++@+++++++.. ",
".#+++++++++++$. ",
".###+++++++$$$. ",
"..####+++$$$$.. ",
"% ..####$$$.. % ",
" % ..##$.. % ",
" % ... % ",
" % % ",
" ",
" "};

View File

@ -1,54 +0,0 @@
module Msf
module Ui
module Wx
class MyApp < ::Wx::App
include Msf::Ui::Wx::MyControls
def on_init()
@frame = MyFrame.new(
nil,
"Metasploit Framework v#{Msf::Framework::Version} GUI",
-1,
-1,
800,
600
)
@frame.create_status_bar(1)
# Create the file menu
file_menu = ::Wx::Menu.new
file_menu.append(APP_MENU_RELOAD, "&Reload Modules")
file_menu.append(APP_MENU_QUIT, "&Quit Metasploit Framework")
help_menu = ::Wx::Menu.new
help_menu.append(APP_MENU_ABOUT, "&About", "About the Metasploit Framework")
# Create the meny bar
menu_bar = ::Wx::MenuBar.new
menu_bar.append(file_menu, "&File")
menu_bar.append(help_menu, "&Help")
# Associate the menu bar with the @frame
@frame.set_menu_bar(menu_bar)
@frame.show(TRUE)
@frame.set_status_text(
"Loaded " +
framework.stats.num_exploits.to_s + " exploits, " +
framework.stats.num_payloads.to_s + " payloads, " +
framework.stats.num_encoders.to_s + " encoders, " +
framework.stats.num_nops.to_s + " nops, and " +
framework.stats.num_auxiliary.to_s + " auxiliary"
)
set_top_window(@frame)
end
end
end
end
end

View File

@ -1,45 +0,0 @@
module Msf
module Ui
module Wx
# ID generator for Wx controls
class IDGen
@@last_id = 1000
def self.alloc
@@last_id += 1
end
end
# Menu items in the main application
APP_MENU_QUIT = IDGen.alloc
APP_MENU_ABOUT = IDGen.alloc
APP_MENU_RELOAD = IDGen.alloc
# Tree controls
FRAME_TREE_MODULES_EXPLOITS = IDGen.alloc
FRAME_TREE_MODULES_PAYLOADS = IDGen.alloc
FRAME_TREE_MODULES_SESSIONS = IDGen.alloc
FRAME_TREE_MODULES_JOBS = IDGen.alloc
# Notebook contrls
NOTE_MODULES = IDGen.alloc
NOTE_CONSOLE = IDGen.alloc
# Panels
PANEL_INFO = IDGen.alloc
# Icons
FRAME_ICONS_MODULES = 0
FRAME_ICONS_EXPLOITS = 1
FRAME_ICONS_AUXILIARY = 2
FRAME_ICONS_PAYLOADS = 3
FRAME_ICONS_ENCODERS = 4
FRAME_ICONS_NOPS = 5
FRAME_ICONS_MOD_EXPLOIT = 6
FRAME_ICONS_MOD_AUXILIARY = 6
FRAME_ICONS_MOD_PAYLOAD = 7
FRAME_ICONS_MOD_ENCODER = 7
FRAME_ICONS_MOD_NOP = 7
end
end
end

View File

@ -1,218 +0,0 @@
module Msf
module Ui
module Wx
module MyControls
#
# Included class methods
#
# Get the global driver handle
def driver
$wxdriver
end
# Return the framework instance from the driver handler
def framework
driver.framework
end
def log(msg)
if ($wxlogger)
$wxlogger.append_text(msg + "\n")
else
$stderr.puts Time.now.to_s + " " + msg
end
end
#
# Controls
#
class MyModuleTree < ::Wx::TreeCtrl
def initialize(parent, id,pos, size,style)
super(parent, id, pos, size, style)
evt_left_dclick { |event| on_dclick(event) }
end
def on_dclick(event)
# $stderr.puts "Double clicked!"
end
end
class MyPanel < ::Wx::Panel
attr_reader :m_note_modules, :m_note_console, :m_panel_exploits, :m_panel_payloads
attr_reader :m_panel_encoders, :m_panel_sessions, :m_panel_jobs, :m_nops
def initialize(frame,x,y,w,h)
super( frame, -1, ::Wx::Point.new(x, y), ::Wx::Size.new(w, h) )
@m_size_panelv = ::Wx::BoxSizer.new( ::Wx::VERTICAL )
@m_size_panelh = ::Wx::BoxSizer.new( ::Wx::HORIZONTAL )
@m_note_modules = ::Wx::Notebook.new(self, NOTE_MODULES)
@m_panel_info = ::Wx::Panel.new( self )
@m_note_console = ::Wx::Notebook.new(self, NOTE_CONSOLE)
@m_panel_info.set_background_colour(::Wx::Colour.new('gray'))
# Create the tabbed tree view pages
@m_panel_exploits = ::Wx::Panel.new(@m_note_modules)
@m_panel_payloads = ::Wx::Panel.new(@m_note_modules)
@m_panel_sessions = ::Wx::Panel.new(@m_note_modules)
@m_panel_jobs = ::Wx::Panel.new(@m_note_modules)
@m_note_modules.add_page(@m_panel_exploits, 'Exploits')
@m_note_modules.add_page(@m_panel_payloads, 'Payloads')
@m_note_modules.add_page(@m_panel_sessions, 'Sessions')
@m_note_modules.add_page(@m_panel_jobs, 'Jobs')
# Create the info pages
@m_panel_inf = ::Wx::Panel.new(@m_note_console)
@m_panel_log = ::Wx::Panel.new(@m_note_console)
@m_panel_con = ::Wx::Panel.new(@m_note_console)
# Create each page of the notebook
@m_note_console.add_page(@m_panel_inf, 'Information')
@m_note_console.add_page(@m_panel_log, 'Attack Log')
@m_note_console.add_page(@m_panel_con, 'Console')
# Create the information text control
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel_inf, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel_inf, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel_inf, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel_inf, ::Wx::LAYOUT_WIDTH, 99 )
@m_text_inf = ::Wx::TextCtrl.new(
@m_panel_inf, -1,
"",
::Wx::Point.new(0, 250),
::Wx::Size.new(100, 50),
::Wx::NO_BORDER |
::Wx::TE_READONLY |
::Wx::TE_MULTILINE
)
@m_text_inf.set_constraints(c)
# Create the log text control
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel_log, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel_log, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel_log, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel_log, ::Wx::LAYOUT_WIDTH, 99 )
@m_text_log = ::Wx::TextCtrl.new(
@m_panel_log, -1,
"",
::Wx::Point.new(0, 250),
::Wx::Size.new(100, 50),
::Wx::NO_BORDER |
::Wx::TE_READONLY |
::Wx::TE_MULTILINE
)
@m_text_log.set_constraints(c)
# Set the global logger instance
$wxlogger = @m_text_log
# Create the console text control
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel_con, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel_con, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel_con, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel_con, ::Wx::LAYOUT_WIDTH, 99 )
@m_text_con = ::Wx::TextCtrl.new(
@m_panel_con, -1,
"",
::Wx::Point.new(0, 250),
::Wx::Size.new(100, 50),
::Wx::NO_BORDER |
::Wx::TE_READONLY |
::Wx::TE_MULTILINE
)
@m_text_con.set_constraints(c)
@m_text_con.append_text("*** The console has not been implemented yet\n msf> ")
# Configure auto-layout (ADD EVERY PANEL TO THIS!)
[
self,
@m_panel_info,
@m_panel_exploits,
@m_panel_payloads,
@m_panel_sessions,
@m_panel_jobs,
@m_panel_log,
@m_panel_con,
@m_panel_inf
].each { |panel| panel.set_auto_layout( TRUE ) }
# Add each panel or notebook to the size
@m_size_panelv.add(@m_note_modules)
@m_size_panelv.add(@m_panel_info)
@m_size_panelv.add(@m_note_console)
# Configure the sizer
set_sizer(@m_size_panelv)
# Add the event hook
evt_size {|event| on_size(event) }
end
def on_module_select(mod)
@m_text_inf.clear
inst = mod.new
buff =
"\n" +
"Type: " + inst.type + "\n" +
"Path: " + inst.refname + "\n" +
"Name: " + inst.name + "\n"
inst.description.each_line do |line|
buff << line.strip + "\n"
end
@m_text_inf.write_text(buff)
end
def on_module_dclick(mod)
Wx::MessageBox.new("You clicked on #{mod.refname}")
end
def on_size(event)
size = get_client_size()
x = size.get_width
y = size.get_height
b = 4
if (@m_note_modules)
@m_note_modules.set_dimensions( b, b, percent(40, x)-b, percent(65, y)-b )
end
if (@m_panel_info)
@m_panel_info.set_dimensions( percent(40, x)+b, b, percent(60, x), percent(65, y))
end
if (@m_note_console)
@m_note_console.set_dimensions( b, percent(65, y)+b, x-b, percent(35, y)-b )
end
end
def percent(mine, total)
((mine.to_f / 100.0) * total).to_i
end
end
end
end
end
end

View File

@ -1,103 +0,0 @@
require 'msf/core'
require 'msf/base'
require 'msf/ui'
require 'msf/ui/wx/constants'
require 'msf/ui/wx/controls'
require 'msf/ui/wx/frame'
require 'msf/ui/wx/app'
module Msf
module Ui
module Wx
###
#
# This class implements a user interface driver on a wx graphical interface.
#
###
class Driver < Msf::Ui::Driver
ConfigCore = "framework/core"
ConfigGroup = "framework/ui/wx"
#
# The default resource directory for msfwx
#
DefaultResourceDirectory = Msf::Config.data_directory + File::SEPARATOR + "msfwx"
#
# Initializes a wx driver instance
#
def initialize(opts = {})
# Call the parent
super()
# Set the passed options hash for referencing later on.
self.opts = opts
# Initialize configuration
Msf::Config.init
# Initialize logging
initialize_logging
# Initialize attributes
self.framework = Msf::Simple::Framework.create
# Create the wxdriver global :(
$wxdriver = self
# Initialize the Wx application object
@wxapp = Msf::Ui::Wx::MyApp.new()
end
#
# Starts the main wx loop
#
def run
ilog("msfwx has been started", LogSource)
@wxapp.main_loop()
true
end
#
# Returns the local directory that will hold the files to be serviced.
#
def resource_directory
opts['ResourceDirectory'] || DefaultResourceDirectory
end
#
# Returns a new Wx::Icon object
#
def get_icon(name)
::Wx::Icon.new(File.join(resource_directory, name))
end
#
# The framework instance associated with this driver.
#
attr_reader :framework
protected
attr_writer :framework # :nodoc:
attr_accessor :opts # :nodoc:
#
# Initializes logging for the web server.
#
def initialize_logging
level = (opts['LogLevel'] || 0).to_i
Msf::Logging.enable_log_source(LogSource, level)
end
end
end
end
end

View File

@ -1,318 +0,0 @@
module Msf
module Ui
module Wx
class MyFrame < ::Wx::Frame
include Msf::Ui::Wx::MyControls
attr_reader :m_panel
def initialize(frame, title, x, y, w, h)
super(frame, -1, title, ::Wx::Point.new(x, y), ::Wx::Size.new(w, h))
# Reduce flicker on scroll
set_background_colour(::Wx::Colour.new(255, 255, 255))
# Give it an icon
set_icon(driver.get_icon('msfwx.xpm'))
# Add handlers for the menu items
evt_menu(APP_MENU_QUIT) {on_quit}
evt_menu(APP_MENU_ABOUT) {on_about}
evt_menu(APP_MENU_RELOAD) {on_reload}
# Create
@m_panel = MyPanel.new( self, 10, 10, 300, 100 )
my_create_module_tree()
end
def on_quit
close(TRUE)
end
def on_about
dialog = ::Wx::MessageDialog.new(
self,
"The is the Metasploit Framework Wx Interface.\n\n",
"About the Metasploit Framework",
::Wx::OK
)
dialog.show_modal()
end
def on_reload
# XXX actually reload the modules!
@m_tree_modules_exploits.delete_all_items
@m_tree_modules_payloads.delete_all_items
@m_tree_modules_sessions.delete_all_items
@m_tree_modules_jobs.delete_all_items
@m_tree_modules_items = {}
my_load_module_tree()
end
def my_create_module_tree()
tree_style =
# ::Wx::TR_TWIST_BUTTONS |
# ::Wx::TR_HAS_BUTTONS |
::Wx::TR_HIDE_ROOT |
::Wx::TR_NO_LINES |
::Wx::TR_FULL_ROW_HIGHLIGHT |
::Wx::TR_DEFAULT_STYLE
@m_tree_modules_exploits = Msf::Ui::Wx::MyControls::MyModuleTree.new(
@m_panel.m_panel_exploits,
FRAME_TREE_MODULES_EXPLOITS,
::Wx::DEFAULT_POSITION,
::Wx::DEFAULT_SIZE,
tree_style
)
@m_tree_modules_payloads = Msf::Ui::Wx::MyControls::MyModuleTree.new(
@m_panel.m_panel_payloads,
FRAME_TREE_MODULES_PAYLOADS,
::Wx::DEFAULT_POSITION,
::Wx::DEFAULT_SIZE,
tree_style
)
@m_tree_modules_sessions = Msf::Ui::Wx::MyControls::MyModuleTree.new(
@m_panel.m_panel_sessions,
FRAME_TREE_MODULES_SESSIONS,
::Wx::DEFAULT_POSITION,
::Wx::DEFAULT_SIZE,
tree_style
)
@m_tree_modules_jobs = Msf::Ui::Wx::MyControls::MyModuleTree.new(
@m_panel.m_panel_jobs,
FRAME_TREE_MODULES_JOBS,
::Wx::DEFAULT_POSITION,
::Wx::DEFAULT_SIZE,
tree_style
)
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel.m_panel_exploits, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel.m_panel_exploits, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel.m_panel_exploits, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel.m_panel_exploits, ::Wx::LAYOUT_WIDTH, 99 )
@m_tree_modules_exploits.set_constraints(c)
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel.m_panel_payloads, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel.m_panel_payloads, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel.m_panel_payloads, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel.m_panel_payloads, ::Wx::LAYOUT_WIDTH, 99 )
@m_tree_modules_payloads.set_constraints(c)
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel.m_panel_sessions, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel.m_panel_sessions, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel.m_panel_sessions, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel.m_panel_sessions, ::Wx::LAYOUT_WIDTH, 99 )
@m_tree_modules_sessions.set_constraints(c)
c = ::Wx::LayoutConstraints.new
c.top.same_as( @m_panel.m_panel_jobs, ::Wx::LAYOUT_TOP, 2 )
c.height.percent_of( @m_panel.m_panel_jobs, ::Wx::LAYOUT_BOTTOM, 95 )
c.left.same_as( @m_panel.m_panel_jobs, ::Wx::LAYOUT_LEFT, 2 )
c.width.percent_of( @m_panel.m_panel_jobs, ::Wx::LAYOUT_WIDTH, 99 )
@m_tree_modules_jobs.set_constraints(c)
my_load_module_tree()
=begin
evt_tree_sel_changing(TreeTest_Ctrl) {|event| onSelChanging(event) }
evt_tree_key_down(TreeTest_Ctrl) {|event| onTreeKeyDown(event) }
evt_tree_item_activated(TreeTest_Ctrl) {|event| onItemActivated(event) }
evt_right_dclick {|event| RMouseDClick(event) }
evt_tree_begin_drag(TreeTest_Ctrl) {|event| onBeginDrag(event) }
evt_tree_begin_rdrag(TreeTest_Ctrl) {|event| onBeginRDrag(event) }
evt_tree_end_drag(TreeTest_Ctrl) {|event| onEndDrag(event) }
evt_tree_begin_label_edit(TreeTest_Ctrl) {|event| onBeginLabelEdit(event) }
evt_tree_end_label_edit(TreeTest_Ctrl) {|event| onEndLabelEdit(event) }
evt_tree_delete_item(TreeTest_Ctrl) {|event| onDeleteItem(event) }
evt_tree_set_info(TreeTest_Ctrl) {|event| onSetInfo(event) }
evt_tree_item_expanded(TreeTest_Ctrl) {|event| onItemExpanded(event) }
evt_tree_item_expanding(TreeTest_Ctrl) {|event| onItemExpanding(event) }
evt_tree_item_collapsed(TreeTest_Ctrl) {|event| onItemCollapsed(event) }
evt_tree_item_collapsing(TreeTest_Ctrl) {|event| onItemCollapsing(event) }
evt_tree_item_right_click(TreeTest_Ctrl) {|event| onItemRightClick(event) }
evt_right_up {|event| onRMouseUp(event) }
=end
evt_tree_sel_changed(FRAME_TREE_MODULES_EXPLOITS) {|event| on_sel_changed_exploits(event) }
evt_tree_sel_changed(FRAME_TREE_MODULES_PAYLOADS) {|event| on_sel_changed_payloads(event) }
evt_tree_sel_changed(FRAME_TREE_MODULES_SESSIONS) {|event| on_sel_changed_sessions(event) }
evt_tree_sel_changed(FRAME_TREE_MODULES_JOBS) {|event| on_sel_changed_jobs(event) }
end
def on_sel_changed_exploits(event)
if (@m_tree_modules_items.has_key?(event.get_item))
@m_panel.on_module_select(@m_tree_modules_items[ event.get_item ])
end
event.skip
end
def on_sel_changed_payloads(event)
if (@m_tree_modules_items.has_key?(event.get_item))
@m_panel.on_module_select(@m_tree_modules_items[ event.get_item ])
end
event.skip
end
def on_dclick_exploits(event)
if (@m_tree_modules_items.has_key?(event.get_item))
@m_panel.on_module_dclick(@m_tree_modules_items[ event.get_item ])
end
event.skip
end
def on_dclick_payloads(event)
if (@m_tree_modules_items.has_key?(event.get_item))
@m_panel.on_module_dclick(@m_tree_modules_items[ event.get_item ])
end
event.skip
end
def on_sel_changed_sessions(event)
event.skip
end
def on_sel_changed_jobs(event)
event.skip
end
def my_load_module_tree(filter=/.*/)
::Wx::BusyCursor.busy do |x|
@m_tree_modules_items = {}
my_load_module_tree_images()
# Load the exploit modules
n_root = @m_tree_modules_exploits.get_root_item()
n_modules = @m_tree_modules_exploits.append_item(n_root, 'Exploits', FRAME_ICONS_MODULES)
n_exploits = @m_tree_modules_exploits.append_item(n_modules, 'Standard', FRAME_ICONS_EXPLOITS)
n_auxiliary = @m_tree_modules_exploits.append_item(n_modules, 'Auxiliary', FRAME_ICONS_AUXILIARY)
framework.exploits.each_module do |mod, obj|
next if not mod.match(filter)
oid = @m_tree_modules_exploits.append_item(n_exploits, obj.new.name, FRAME_ICONS_MOD_EXPLOIT)
@m_tree_modules_items[oid] = obj
end
framework.auxiliary.each_module do |mod, obj|
next if not mod.match(filter)
oid = @m_tree_modules_exploits.append_item(n_auxiliary, obj.new.name, FRAME_ICONS_MOD_AUXILIARY)
@m_tree_modules_items[oid] = obj
end
@m_tree_modules_exploits.expand(n_modules)
# Load the non-exploit modules
n_root = @m_tree_modules_payloads.get_root_item()
n_modules = @m_tree_modules_payloads.append_item(n_root, 'Modules', FRAME_ICONS_MODULES)
n_payloads = @m_tree_modules_payloads.append_item(n_modules, 'Payloads', FRAME_ICONS_PAYLOADS)
n_encoders = @m_tree_modules_payloads.append_item(n_modules, 'Encoders', FRAME_ICONS_ENCODERS)
n_nops = @m_tree_modules_payloads.append_item(n_modules, 'Nops', FRAME_ICONS_NOPS)
framework.payloads.each_module do |mod, obj|
next if not mod.match(filter)
oid = @m_tree_modules_payloads.append_item(n_payloads, obj.new.name, FRAME_ICONS_MOD_PAYLOAD)
@m_tree_modules_items[oid] = obj
end
framework.encoders.each_module do |mod, obj|
next if not mod.match(filter)
oid = @m_tree_modules_payloads.append_item(n_encoders, obj.new.name, FRAME_ICONS_MOD_ENCODER)
@m_tree_modules_items[oid] = obj
end
framework.nops.each_module do |mod, obj|
next if not mod.match(filter)
oid = @m_tree_modules_payloads.append_item(n_nops, obj.new.name, FRAME_ICONS_MOD_NOP)
@m_tree_modules_items[oid] = obj
end
@m_tree_modules_exploits.expand(n_modules)
# Load the sessions list
n_root = @m_tree_modules_sessions.get_root_item()
n_sessions = @m_tree_modules_sessions.append_item(n_root, 'Sessions', FRAME_ICONS_MODULES)
n_shells = @m_tree_modules_sessions.append_item(n_sessions, 'Shell Sessions', FRAME_ICONS_EXPLOITS)
@m_tree_modules_sessions.expand(n_sessions)
# Load the jobs list
n_root = @m_tree_modules_jobs.get_root_item()
n_jobs = @m_tree_modules_jobs.append_item(n_root, 'Jobs', FRAME_ICONS_MODULES)
n_passive = @m_tree_modules_jobs.append_item(n_jobs, 'Passive Exploits', FRAME_ICONS_EXPLOITS)
n_auxiliary = @m_tree_modules_jobs.append_item(n_jobs, 'Auxiliary Modules', FRAME_ICONS_AUXILIARY)
@m_tree_modules_jobs.expand(n_jobs)
end
end
def my_load_module_tree_images
isize = 16
icons = []
icons[FRAME_ICONS_MODULES] = driver.get_icon('modules.xpm')
icons[FRAME_ICONS_EXPLOITS] = driver.get_icon('exploits.xpm')
icons[FRAME_ICONS_AUXILIARY] = driver.get_icon('auxiliary.xpm')
icons[FRAME_ICONS_PAYLOADS] = driver.get_icon('payloads.xpm')
icons[FRAME_ICONS_ENCODERS] = driver.get_icon('encoders.xpm')
icons[FRAME_ICONS_NOPS] = driver.get_icon('nops.xpm')
icons[FRAME_ICONS_MOD_EXPLOIT] = driver.get_icon('mod_exploit.xpm')
icons[FRAME_ICONS_MOD_PAYLOAD] = driver.get_icon('mod_payload.xpm')
# XXXX We need a unique ImageList for every TreeView or we SEGV on cleanup!!!
# Make an image list containing small icons
exploit_images = ::Wx::ImageList.new(isize, isize, TRUE)
payload_images = ::Wx::ImageList.new(isize, isize, TRUE)
session_images = ::Wx::ImageList.new(isize, isize, TRUE)
job_images = ::Wx::ImageList.new(isize, isize, TRUE)
for i in 0 ... icons.length
next if not icons[i]
sizeOrig = icons[i].get_width()
if isize == sizeOrig
exploit_images.add(icons[i])
payload_images.add(icons[i])
session_images.add(icons[i])
job_images.add(icons[i])
else
exploit_images.add(::Wx::Bitmap.new(icons[i].convert_to_image.rescale(isize, isize)))
payload_images.add(::Wx::Bitmap.new(icons[i].convert_to_image.rescale(isize, isize)))
session_images.add(::Wx::Bitmap.new(icons[i].convert_to_image.rescale(isize, isize)))
job_images.add(::Wx::Bitmap.new(icons[i].convert_to_image.rescale(isize, isize)))
end
end
@m_tree_modules_exploits.assign_image_list(exploit_images)
@m_tree_modules_payloads.assign_image_list(payload_images)
@m_tree_modules_sessions.assign_image_list(session_images)
@m_tree_modules_jobs.assign_image_list(job_images)
end
def resize
size = get_client_size()
@m_tree_modules_exploits.set_size_xy(size.x, 2*size.y/3)
@m_tree_modules_payloads.set_size_xy(size.x, 2*size.y/3)
@m_tree_modules_sessions.set_size_xy(size.x, 2*size.y/3)
@m_tree_modules_jobs.set_size_xy(size.x, 2*size.y/3)
end
end
end
end
end

51
msfwx
View File

@ -1,51 +0,0 @@
#!/usr/bin/env ruby
#
# This is a basic user interface using the Wx GUI library
#
msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
$:.unshift(File.join(File.dirname(msfbase), 'lib'))
require 'rex'
require 'msf/base'
require 'msf/ui'
begin
require 'wxruby'
rescue ::Exception => e
$stderr.puts "[*] The msfwx interface requires the wxruby package"
exit(0)
end
require 'msf/ui/wx'
# Declare the argument parser for msfwx
arguments = Rex::Parser::Arguments.new(
"-v" => [ true, "A number between 0 and 3 that controls log verbosity" ],
"-d" => [ false, "Keep running in the foreground" ],
"-h" => [ false, "Help banner" ])
opts = {}
background = false
# Parse command line arguments.
arguments.parse(ARGV) { |opt, idx, val|
case opt
when "-v"
opts['LogLevel'] = val
when "-d"
background = true
when "-h"
print(
"\nUsage: msfwx <options>\n" +
arguments.usage)
exit
end
}
exit if (Process.fork()) unless background == false
# Create the driver instance and run it.
Msf::Ui::Wx::Driver.new(opts).run