More UI updates
git-svn-id: file:///home/svn/framework3/trunk@5293 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
c07105c70a
commit
289d280291
|
@ -689,6 +689,14 @@
|
|||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="view_code">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
|
|
@ -44,9 +44,9 @@ module Interactive
|
|||
#
|
||||
def tunnel_peer
|
||||
begin
|
||||
rstream.peerinfo
|
||||
@peer_info = rstream.peerinfo
|
||||
rescue
|
||||
framework.sessions.deregister(self)
|
||||
@peer_info
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module Msf
|
|||
["Select your options", "option", true, true, true, false],
|
||||
],
|
||||
['Review',
|
||||
["Check your review", "end", true, true, true, true],
|
||||
["Confirm settings", "end", true, true, true, true],
|
||||
],
|
||||
].collect do |item, state|
|
||||
WIZARD2[item] = WizardStruct2.new(
|
||||
|
|
|
@ -34,7 +34,7 @@ module Msf
|
|||
["Select your options", "option", true, true, true, false],
|
||||
],
|
||||
['Review',
|
||||
["Check your review", "end", true, true, true, true],
|
||||
["Confirm settings", "end", true, true, true, true],
|
||||
],
|
||||
].collect do |item, state|
|
||||
WIZARD[item] = WizardStruct.new(
|
||||
|
@ -329,13 +329,28 @@ module Msf
|
|||
@options_evasion.remove(widget)
|
||||
end
|
||||
|
||||
# Pack
|
||||
self.main.pack_start(@options_required, false, false, 10)
|
||||
|
||||
# TODO: Display temporaly desactived
|
||||
|
||||
|
||||
# Pack
|
||||
#self.main.pack_start(@options_required, false, false, 10)
|
||||
#self.main.pack_start(@frame_advanced, false, false, 10)
|
||||
#self.main.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
scrl = Gtk::ScrolledWindow.new
|
||||
scrl.shadow_type = Gtk::SHADOW_NONE
|
||||
scrl.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
|
||||
vscr = Gtk::VBox.new
|
||||
|
||||
vscr.pack_start(@options_required, false, false, 10)
|
||||
vscr.pack_start(@frame_advanced, false, false, 10)
|
||||
vscr.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
scrl.add_with_viewport(vscr)
|
||||
|
||||
self.main.pack_start(scrl, false, false, 20)
|
||||
|
||||
# Payload options
|
||||
@mydriver.payload = framework.payloads.create(@hash["PAYLOAD"])
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ module Msf
|
|||
def initialize(title)
|
||||
super()
|
||||
self.resizable = false
|
||||
self.set_default_size(600, 400)
|
||||
self.set_window_position(Gtk::Window::POS_CENTER)
|
||||
self.title = title
|
||||
|
||||
self.set_border_width(1)
|
||||
|
||||
# First page
|
||||
@page = "intro"
|
||||
|
||||
|
@ -42,8 +43,8 @@ module Msf
|
|||
@vbox_left.pack_start(create_save(), false, false, 5)
|
||||
|
||||
# Main frame
|
||||
@main = Gtk::VBox.new(false, 5)
|
||||
@hbox.pack_start(@main, true, true, 5)
|
||||
@main = Gtk::VBox.new(false, 10)
|
||||
@hbox.pack_start(@main, true, true, 10)
|
||||
|
||||
# Separator
|
||||
separator = Gtk::HSeparator.new
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
module Msf
|
||||
module Ui
|
||||
module Gtk2
|
||||
|
||||
class MsfDialog
|
||||
##
|
||||
# Display an error Gtk style
|
||||
# parent: the Gtk parent widget
|
||||
# title: the error title
|
||||
# message: the error
|
||||
##
|
||||
class Confirm < Msf::Ui::Gtk2::SkeletonAlert
|
||||
def initialize(parent, title, message=nil)
|
||||
super(parent, title, Gtk::Stock::DIALOG_WARNING,
|
||||
[
|
||||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
||||
[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK]
|
||||
],
|
||||
message
|
||||
)
|
||||
self.default_response = Gtk::Dialog::RESPONSE_CANCEL
|
||||
|
||||
signal_connect("response") do |dialog,res_id|
|
||||
if(res_id == Gtk::Dialog::RESPONSE_OK)
|
||||
yield()
|
||||
end
|
||||
end
|
||||
|
||||
show_all and run
|
||||
destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -39,4 +39,4 @@ module Msf
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,4 +7,5 @@ require 'msf/ui/gtk2/dialog/skeleton_browser'
|
|||
require 'msf/ui/gtk2/dialog/payload'
|
||||
require 'msf/ui/gtk2/dialog/error'
|
||||
require 'msf/ui/gtk2/dialog/warning'
|
||||
require 'msf/ui/gtk2/dialog/information'
|
||||
require 'msf/ui/gtk2/dialog/information'
|
||||
require 'msf/ui/gtk2/dialog/confirm'
|
||||
|
|
|
@ -138,7 +138,19 @@ module Gtk2
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@view_code.signal_connect('activate') do |item|
|
||||
if active_module = @selection.selected
|
||||
type = active_module.get_value(TYPE)
|
||||
if (type == EXP or type == AUX)
|
||||
MsfWindow::CodeView.new(active_module.get_value(MOD))
|
||||
elsif (type == DIR)
|
||||
# Ignore
|
||||
else
|
||||
MsfDialog::Error.new($gtk2driver.main, "Not available")
|
||||
end
|
||||
end
|
||||
end
|
||||
# Add modules in the Gtk::TreeView
|
||||
add_modules()
|
||||
|
||||
|
@ -178,6 +190,32 @@ module Gtk2
|
|||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Prune empty module directories from the hash
|
||||
#
|
||||
def prune_hash(key, hash)
|
||||
|
||||
cnt = 0
|
||||
|
||||
hash.keys.each do |k|
|
||||
if(hash[k].class != ::Hash)
|
||||
cnt += 1
|
||||
next
|
||||
end
|
||||
|
||||
num = prune_hash(k, hash[k])
|
||||
if (num == 0)
|
||||
hash.delete(k)
|
||||
end
|
||||
|
||||
cnt += num
|
||||
end
|
||||
|
||||
# $stdout.puts "#{key} == #{cnt}"
|
||||
|
||||
cnt
|
||||
end
|
||||
|
||||
#
|
||||
# Add Exploits module in the treeview
|
||||
#
|
||||
|
@ -193,10 +231,20 @@ module Gtk2
|
|||
ref[part] ||= {}
|
||||
ref = ref[part]
|
||||
end
|
||||
|
||||
ref[name] = obj.new
|
||||
|
||||
ins = obj.new
|
||||
if (
|
||||
mod =~ filter or
|
||||
ins.name =~ filter or
|
||||
ins.description.gsub(/\s+/, " ") =~ filter or
|
||||
ins.author_to_s =~ filter or
|
||||
ins.references.map {|x| x.to_s}.join(" ") =~ filter
|
||||
)
|
||||
ref[name] = obj.new
|
||||
end
|
||||
end
|
||||
|
||||
prune_hash("exploits", mod_exploits)
|
||||
|
||||
mod_auxiliary = {}
|
||||
framework.auxiliary.each_module do |mod, obj|
|
||||
|
@ -208,9 +256,21 @@ module Gtk2
|
|||
ref = ref[part]
|
||||
end
|
||||
|
||||
ref[name] = obj.new
|
||||
ins = obj.new
|
||||
if (
|
||||
mod =~ filter or
|
||||
ins.name =~ filter or
|
||||
ins.description.gsub(/\s+/, " ") =~ filter or
|
||||
ins.author_to_s =~ filter or
|
||||
ins.references.map {|x| x.to_s}.join(" ") =~ filter
|
||||
)
|
||||
ref[name] = obj.new
|
||||
end
|
||||
end
|
||||
|
||||
prune_hash("auxiliary", mod_auxiliary)
|
||||
|
||||
|
||||
add_modules_to_store(
|
||||
@model, nil, "Exploits", mod_exploits,
|
||||
{
|
||||
|
@ -232,7 +292,6 @@ module Gtk2
|
|||
:type => AUX
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# TODO: To implement later ...
|
||||
|
@ -307,9 +366,9 @@ module Gtk2
|
|||
#
|
||||
# Refresh the module treeview with all msf modules
|
||||
#
|
||||
def refresh
|
||||
def refresh(filter=/.*/)
|
||||
@model.clear()
|
||||
add_modules()
|
||||
add_modules(filter)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -58,6 +58,10 @@ module Msf
|
|||
found = []
|
||||
filter = Regexp.new(text, Regexp::IGNORECASE)
|
||||
|
||||
$gtk2driver.module_tree.refresh(filter)
|
||||
$gtk2driver.module_tree.expand
|
||||
return
|
||||
|
||||
i_type = Msf::Ui::Gtk2::MyModuleTree::TYPE
|
||||
i_type_dir = Msf::Ui::Gtk2::MyModuleTree::DIR
|
||||
i_desc = Msf::Ui::Gtk2::MyModuleTree::DESC
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
require 'msf/ui/gtk2/window/logs'
|
||||
require 'msf/ui/gtk2/window/auxiliary'
|
||||
require 'msf/ui/gtk2/window/consoles'
|
||||
|
||||
|
||||
require 'msf/ui/gtk2/window/codeview'
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
module Msf
|
||||
module Ui
|
||||
module Gtk2
|
||||
|
||||
class MsfWindow
|
||||
|
||||
#
|
||||
# This class performs a Gtk::Window to display logs from framework
|
||||
#
|
||||
class CodeView < Msf::Ui::Gtk2::SkeletonBasic
|
||||
|
||||
include Msf::Ui::Gtk2::MyControls
|
||||
|
||||
def initialize(m)
|
||||
|
||||
# call the parent
|
||||
super("Source Code of #{m.type.capitalize} #{m.refname}")
|
||||
|
||||
# Define the size and border
|
||||
set_default_size(600, 480)
|
||||
set_border_width(10)
|
||||
|
||||
# Main hbox
|
||||
vbox = Gtk::VBox.new(false, 0)
|
||||
add(vbox)
|
||||
|
||||
textview = Gtk::TextView.new
|
||||
textview.set_editable(false)
|
||||
|
||||
sw = Gtk::ScrolledWindow.new()
|
||||
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
vbox.pack_start(sw, true, true, 0)
|
||||
|
||||
sw.add(textview)
|
||||
|
||||
|
||||
buff = textview.buffer
|
||||
fixr = buff.create_tag("fixr",
|
||||
{
|
||||
"font" => "Courier"
|
||||
}
|
||||
)
|
||||
|
||||
buff.insert(buff.end_iter, File.read(m.file_path), "fixr")
|
||||
|
||||
show_all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,6 +13,7 @@ class MsfWindow
|
|||
attr_accessor :input, :prompt
|
||||
attr_accessor :pipe, :console
|
||||
attr_accessor :console_thread, :reader_thread
|
||||
attr_accessor :console_window
|
||||
|
||||
class MyPipe < Rex::IO::BidirectionalPipe
|
||||
def prompting?
|
||||
|
@ -126,18 +127,43 @@ class MsfWindow
|
|||
self.output.buffer.text = ""
|
||||
self.history = []
|
||||
self.hindex = 0
|
||||
when 'irb'
|
||||
skip = true
|
||||
end
|
||||
|
||||
self.history.push(line)
|
||||
self.hindex = self.history.length - 1
|
||||
self.output.append_output(self.output.prompt.text) if not self.output.console.busy
|
||||
self.output.append_output(line + "\n")
|
||||
self.output.pipe.write_input(line+"\n") if not skip
|
||||
|
||||
|
||||
obj.text = ''
|
||||
end
|
||||
|
||||
self.signal_connect('key-press-event') do |obj, key|
|
||||
|
||||
case key.keyval
|
||||
|
||||
when "c"[0]
|
||||
if (key.state.name == "GDK_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")
|
||||
self.output.console.active_session.kill()
|
||||
}
|
||||
end
|
||||
true
|
||||
end
|
||||
when "z"[0]
|
||||
if (key.state.name == "GDK_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")
|
||||
self.output.console.active_session.detach()
|
||||
}
|
||||
end
|
||||
true
|
||||
end
|
||||
when Gdk::Keyval::GDK_Up
|
||||
if history.length > 0
|
||||
self.text = history[hindex]
|
||||
|
@ -246,6 +272,8 @@ class MsfWindow
|
|||
vbox = Gtk::VBox.new
|
||||
scrl = Gtk::ScrolledWindow.new
|
||||
text = ConsoleOutput.new
|
||||
|
||||
text.console_window = self
|
||||
|
||||
text.editable = false
|
||||
text.accepts_tab = false
|
||||
|
@ -267,7 +295,6 @@ class MsfWindow
|
|||
input = MyInput.new(text)
|
||||
input.set_size_request(-1, 25)
|
||||
input.has_frame = false
|
||||
input.focus = true
|
||||
|
||||
text.prompt = prompt
|
||||
|
||||
|
@ -285,6 +312,7 @@ class MsfWindow
|
|||
tab.set_page(tab.page_num(vbox))
|
||||
input.can_focus = true
|
||||
input.has_focus = true
|
||||
input.focus = true
|
||||
|
||||
label_btn.signal_connect("clicked") do |obj|
|
||||
idx = tab.page_num(vbox)
|
||||
|
@ -316,6 +344,9 @@ class MsfWindow
|
|||
hbox = Gtk::HBox.new
|
||||
|
||||
btn = Gtk::Button.new("New Console")
|
||||
btn.set_image(Gtk::Image.new(Gtk::Stock::NEW, Gtk::IconSize::MENU))
|
||||
btn.relief = Gtk::RELIEF_NONE
|
||||
|
||||
hbox.add(btn)
|
||||
|
||||
vbox.pack_start(hbox, false, false, 0)
|
||||
|
|
Loading…
Reference in New Issue