Graphical interface to Opcode database

git-svn-id: file:///home/svn/framework3/trunk@4729 4d416f70-5f16-0410-b530-b9f4589650da
unstable
fab 2007-04-22 00:01:56 +00:00
parent 39560372c8
commit 258970bc5e
4 changed files with 230 additions and 2 deletions

View File

@ -71,6 +71,91 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="opcodes">
<property name="visible">True</property>
<property name="label" translatable="yes">Opcodes</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="opcodes_menu">
<child>
<widget class="GtkMenuItem" id="stats">
<property name="visible">True</property>
<property name="label" translatable="yes">Stats</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_stats_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="locales">
<property name="visible">True</property>
<property name="label" translatable="yes">Locales</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_locales_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="metatypes">
<property name="visible">True</property>
<property name="label" translatable="yes">metatypes</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_metatypes_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="groups">
<property name="visible">True</property>
<property name="label" translatable="yes">Groups</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_groups_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="types">
<property name="visible">True</property>
<property name="label" translatable="yes">Types</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_types_activate" last_modification_time="Sat, 21 Apr 2007 22:46:16 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="platforms">
<property name="visible">True</property>
<property name="label" translatable="yes">Platforms</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_platforms_activate" last_modification_time="Sat, 21 Apr 2007 22:46:21 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="modules">
<property name="visible">True</property>
<property name="label" translatable="yes">Modules</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_modules_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="search">
<property name="visible">True</property>
<property name="label" translatable="yes">Search</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_search_activate" last_modification_time="Sat, 21 Apr 2007 22:40:02 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="parameters">
<property name="visible">True</property>
@ -97,7 +182,7 @@
<signal name="activate" handler="on_databases_activate" last_modification_time="Sat, 24 Mar 2007 22:11:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image24">
<widget class="GtkImage" id="image43">
<property name="visible">True</property>
<property name="stock">gtk-network</property>
<property name="icon_size">1</property>
@ -118,7 +203,7 @@
<signal name="activate" handler="on_options_activate" last_modification_time="Sun, 25 Mar 2007 10:15:39 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image25">
<widget class="GtkImage" id="image44">
<property name="visible">True</property>
<property name="stock">gtk-zoom-fit</property>
<property name="icon_size">1</property>

View File

@ -106,6 +106,57 @@ class MyApp < MyGlade
Gtk.main_quit
end
#
# Actions for OpCodes/Stats
#
def on_stats_activate
MsfOpcode::Stats.new()
end
#
# Actions for OpCodes/Locales
#
def on_locales_activate
end
#
# Actions for OpCodes/Metatypes
#
def on_metatypes_activate
end
#
# Actions for OpCodes/Groups
#
def on_groups_activate
end
#
# Actions for OpCodes/Types
#
def on_types_activate
end
#
# Actions for OpCodes/Platforms
#
def on_platforms_activate
end
#
# Actions for OpCodes/Modules
#
def on_modules_activate
MsfOpcode::Modules.new()
end
#
# Actions for OpCodes/Search
#
def on_search_activate
end
#
# Action for "Parameters/Preferences"
#

View File

@ -12,6 +12,7 @@ require 'msf/ui/gtk2/console'
require 'msf/ui/gtk2/view'
require 'msf/ui/gtk2/search'
require 'msf/ui/gtk2/parameters'
require 'msf/ui/gtk2/opcode'
require 'msf/ui/gtk2/framework_event_manager'

91
lib/msf/ui/gtk2/opcode.rb Normal file
View File

@ -0,0 +1,91 @@
module Msf
module Ui
module Gtk2
require 'rex'
require 'rex/ui'
require 'rex/exploitation/opcodedb'
##
# Gtk2 Interface for msfopcode
##
#
# Skeleton for opcodes stuff
#
class SkeletonOpcode < Gtk::Dialog
attr_accessor :sw
def initialize(title, items)
super("", $gtk2driver.main, Gtk::Dialog::DESTROY_WITH_PARENT,
[ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE ],
[ Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE ])
self.border_width = 6
self.resizable = true
self.has_separator = true
self.vbox.spacing = 12
self.vbox.set_homogeneous(false)
self.title = title
self.set_default_size(500, 400)
@hbox = Gtk::HBox.new(false, 10)
self.vbox.pack_start(@hbox, true, true, 0)
# ScrolledWindow
@sw = Gtk::ScrolledWindow.new
@sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@hbox.pack_start(@sw)
end
end
class MsfOpcode
# Create the opcode client instance
$client = Rex::Exploitation::OpcodeDb::Client.new
class Stats < Msf::Ui::Gtk2::SkeletonOpcode
def initialize
super("Statistics", nil)
self.set_default_size(500, 230)
stats = $client.statistics
textview = Gtk::TextView.new
textbuffer = Gtk::TextBuffer.new
sw.add(textview)
textbuffer.set_text(
"\n" +
"Last Updated : #{stats.last_update.to_s}\n" +
"Number of Opcodes : #{stats.opcodes}\n" +
"Number of Opcode Types : #{stats.opcode_types}\n" +
"Number of Platforms : #{stats.platforms}\n" +
"Number of Architectures : #{stats.architectures}\n" +
"Number of Modules : #{stats.modules}\n" +
"Number of Module Segments: #{stats.module_segments}\n" +
"Number of Module Imports : #{stats.module_imports}\n" +
"Number of Module Exports : #{stats.module_exports}\n\n")
textview.set_buffer(textbuffer)
textview.set_editable(false)
textview.set_cursor_visible(false)
show_all and run
destroy
end
end
class Modules < Msf::Ui::Gtk2::SkeletonOpcode
def initialize
super("Modules", nil)
show_all and run
destroy
end
end
end
end
end
end