More code

git-svn-id: file:///home/svn/incoming/trunk@3468 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2006-01-29 03:08:04 +00:00
parent 7a086113d3
commit e01b5aee85
2 changed files with 50 additions and 8 deletions

View File

@ -56,17 +56,41 @@ class MyPanel < ::Wx::Panel
# Create the module 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_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')
# Create the log/console pages
# 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)
@m_note_console.add_page(@m_panel_log, 'Logs')
# 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 )
@ -115,7 +139,8 @@ class MyPanel < ::Wx::Panel
@m_panel_exploits,
@m_panel_payloads,
@m_panel_log,
@m_panel_con
@m_panel_con,
@m_panel_inf
].each { |panel| panel.set_auto_layout( TRUE ) }
# Add each panel or notebook to the size
@ -130,6 +155,23 @@ class MyPanel < ::Wx::Panel
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_size(event)
size = get_client_size()
@ -138,15 +180,15 @@ class MyPanel < ::Wx::Panel
b = 4
if (@m_note_modules)
@m_note_modules.set_dimensions( b, b, percent(33, x)-b, percent(70, y)-b )
@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(33, x)+b, b, percent(67, x), percent(70, y))
@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(70, y)+b, x-b, percent(30, y)-b )
@m_note_console.set_dimensions( b, percent(65, y)+b, x-b, percent(35, y)-b )
end
end

View File

@ -55,7 +55,7 @@ class MyFrame < ::Wx::Frame
tree_style =
# ::Wx::TR_TWIST_BUTTONS |
# ::Wx::TR_HAS_BUTTONS |
::Wx::SUNKEN_BORDER |
::Wx::TR_HIDE_ROOT |
::Wx::TR_NO_LINES |
::Wx::TR_FULL_ROW_HIGHLIGHT |
::Wx::TR_DEFAULT_STYLE
@ -117,7 +117,7 @@ class MyFrame < ::Wx::Frame
def on_sel_changed(event)
if (@m_tree_modules_items.has_key?(event.get_item))
log("User selected module " + @m_tree_modules_items[ event.get_item ].refname)
@m_panel.on_module_select(@m_tree_modules_items[ event.get_item ])
end
event.skip
end