More UI work

git-svn-id: file:///home/svn/framework3/trunk@5298 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2008-01-21 01:04:41 +00:00
parent 69d99baf14
commit 9a24ffcb5a
4 changed files with 53 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

View File

@ -276,7 +276,7 @@ module Gtk2
{
:top_icon => "bug.png",
:top_desc => "All loaded exploit modules (#{framework.stats.num_exploits.to_s})",
:dir_icon => "msf_local_folder.png",
:dir_icon => "gnome-fs-directory.png",
:mod_icon => "bug.png",
:type => EXP
}
@ -287,7 +287,7 @@ module Gtk2
{
:top_icon => "zoom.png",
:top_desc => "All loaded auxiliary modules (#{framework.stats.num_auxiliary.to_s})",
:dir_icon => "msf_local_folder.png",
:dir_icon => "gnome-fs-directory.png",
:mod_icon => "zoom.png",
:type => AUX
}

View File

@ -16,11 +16,11 @@ class MsfWindow
def initialize(m)
# call the parent
super("Source Code of #{m.type.capitalize} #{m.refname}")
super("View Source: #{m.file_path}")
# Define the size and border
set_default_size(600, 480)
set_border_width(10)
set_border_width(1)
# Main hbox
vbox = Gtk::VBox.new(false, 0)
@ -44,13 +44,11 @@ class MsfWindow
)
font_desc = Pango::FontDescription.new('Courier')
font_desc = Pango::FontDescription.new('Courier 10')
textview.modify_font(font_desc)
# textview.set_pixels_above_lines(2)
# textview.set_pixels_below_lines(2)
buff.create_tag('comment', {'foreground' => 'ForestGreen'})
buff.create_tag('comment', {'foreground' => 'DarkGray'})
buff.create_tag('const', {'foreground' => 'DarkGreen'})
buff.create_tag('method', {'foreground' => 'DarkRed'})
buff.create_tag('string', {
@ -82,6 +80,7 @@ class MsfWindow
#
# Pulled from ruby-gtk2 / gtk-demo (under Ruby license)
# Modified to work better with MSF module source
#
class RubyTokenizer
RESERVED_WORDS = %w(begin end module class def if then else while unless do case when require yield)

View File

@ -53,7 +53,9 @@ class MsfWindow
'LocalOutput' => self.pipe
}
)
bang()
self.console_thread = Thread.new {
begin
@ -77,18 +79,44 @@ class MsfWindow
else
select(nil, nil, nil, 0.10)
end
self.prompt.text = self.pipe.prompt
if (self.console.busy)
self.prompt.text = " (busy) "
if (self.console.active_session)
case self.console.active_session.type
when 'meterpreter'
# Show the meterpreter prompt
self.prompt.text = "meterpreter> "
when 'shell'
# Show the remote shell prompt
data.strip!
if(data.length > 0)
self.prompt.text = data.split(/\n/)[-1].strip
end
else
# Busy with an unknown session type
self.prompt.text = " ( busy ) "
end
else
# No active session, just busy
self.prompt.text = " ( busy ) "
end
else
# Not busy, show the normal prompt
self.prompt.text = self.pipe.prompt
end
self.prompt.width_chars = self.prompt.text.length
end
rescue ::TypeError
stop_console
rescue ::Exception => e
# $stderr.puts "#{e.class} #{e} #{e.backtrace}"
# $stderr.puts "#{e.class} #{e} #{e.backtrace}"
end
}
end
@ -144,8 +172,8 @@ class MsfWindow
case key.keyval
when "c"[0]
if (key.state.name == "GDK_CONTROL_MASK")
when Gdk::Keyval::GDK_c
if (key.state.control_mask?)
if(self.output.console.active_session)
MsfDialog::Confirm.new(self.output.console_window, "Close Session", "Close this session?") {
self.output.append_output("\n[*] Closing session...\n")
@ -154,8 +182,8 @@ class MsfWindow
end
true
end
when "z"[0]
if (key.state.name == "GDK_CONTROL_MASK")
when Gdk::Keyval::GDK_z
if (key.state.control_mask?)
if(self.output.console.active_session)
MsfDialog::Confirm.new(self.output.console_window, "Suspend Session", "Suspend this session?") {
self.output.append_output("\n[*] Suspending session...\n")
@ -163,7 +191,13 @@ class MsfWindow
}
end
true
end
end
when Gdk::Keyval::GDK_u
if (key.state.control_mask?)
self.text = ""
self.position = 0
true
end
when Gdk::Keyval::GDK_Up
if history.length > 0
self.text = history[hindex]