- Gtk::Entry on the console is done, cmd redirects to stdout
git-svn-id: file:///home/svn/framework3/trunk@4328 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
7be3d1c3de
commit
c23760c445
|
@ -1052,6 +1052,7 @@
|
|||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">True</property>
|
||||
<signal name="activate" handler="on_cmd_entry_activate" last_modification_time="Mon, 05 Feb 2007 21:24:46 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
|
@ -398,6 +398,7 @@ class MsfAssistant
|
|||
@session_tree,
|
||||
@hash,
|
||||
session,
|
||||
pipe,
|
||||
input,
|
||||
output)
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ class MyTargetTree < MyGlade
|
|||
end #class MyTargetTree
|
||||
|
||||
class MySessionTree
|
||||
ID_SESSION, TARGET, PAYLOAD, O_SESSION, BUFFER, INPUT, OUTPUT = *(0..7).to_a
|
||||
ID_SESSION, TARGET, PAYLOAD, O_SESSION, BUFFER, PIPE, INPUT, OUTPUT = *(0..8).to_a
|
||||
|
||||
def initialize(treeview)
|
||||
@treeview = treeview
|
||||
|
@ -411,6 +411,7 @@ class MySessionTree
|
|||
String, # Payload Type
|
||||
Object, # Session Object
|
||||
Object, # Gtk::TextBuffer Object
|
||||
Object, # Bidirectional_pipe
|
||||
Object, # Input Object
|
||||
Object # Output Object
|
||||
)
|
||||
|
@ -497,6 +498,7 @@ class MySessionTree
|
|||
if current = @selection.selected
|
||||
Msf::Ui::Gtk2::Stream::Console.new(current[O_SESSION],
|
||||
current[BUFFER],
|
||||
current[PIPE],
|
||||
current[INPUT],
|
||||
current[OUTPUT]
|
||||
)
|
||||
|
@ -505,13 +507,14 @@ class MySessionTree
|
|||
|
||||
end # def initialize
|
||||
|
||||
def add_session(session, options, buffer, input, output)
|
||||
def add_session(session, options, buffer, pipe, input, output)
|
||||
iter = @model.append
|
||||
iter[ID_SESSION] = session.sid.to_s
|
||||
iter[TARGET] = options['RHOST']
|
||||
iter[PAYLOAD] = options['PAYLOAD']
|
||||
iter[O_SESSION] = session
|
||||
iter[BUFFER] = buffer
|
||||
iter[PIPE] = pipe
|
||||
iter[INPUT] = input
|
||||
iter[OUTPUT] = output
|
||||
|
||||
|
|
|
@ -5,16 +5,20 @@ module Stream
|
|||
|
||||
class Console < MyGlade
|
||||
|
||||
def initialize(session, buffer, input, output)
|
||||
def initialize(session, buffer, pipe, input, output)
|
||||
super('console2')
|
||||
|
||||
@textview.set_buffer(buffer)
|
||||
|
||||
@buffer = buffer
|
||||
@session = session
|
||||
@pipe = pipe
|
||||
@input = input
|
||||
@output = output
|
||||
|
||||
# Create a read subscriber
|
||||
@pipe.create_subscriber(@session.sid)
|
||||
|
||||
@output.print_status("Session #{@session.sid} created, interacting")
|
||||
@output.print_line
|
||||
|
||||
|
@ -25,9 +29,40 @@ class Console < MyGlade
|
|||
|
||||
@session.init_ui(@input, @output)
|
||||
@session.interact
|
||||
update_access
|
||||
|
||||
@console2.destroy
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# update access
|
||||
#
|
||||
def update_access
|
||||
last_access = Time.now
|
||||
end
|
||||
#
|
||||
# Signal for user entry
|
||||
#
|
||||
def on_cmd_entry_activate
|
||||
send_cmd(@cmd_entry.text)
|
||||
end
|
||||
|
||||
#
|
||||
# Send command to bidirectionnal_pipe
|
||||
#
|
||||
def send_cmd(cmd)
|
||||
|
||||
update_access
|
||||
|
||||
# Puts cmd
|
||||
puts cmd
|
||||
@pipe.write_input(cmd)
|
||||
@pipe.read_subscriber(@session.sid)
|
||||
|
||||
# Clear entry
|
||||
@cmd_entry.set_text("")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,12 +5,12 @@ module Stream
|
|||
|
||||
class Session
|
||||
|
||||
def initialize(buffer, session_tree, options, session, input, output)
|
||||
def initialize(buffer, session_tree, options, session, pipe, input, output)
|
||||
|
||||
@session_tree = session_tree
|
||||
@session = session
|
||||
|
||||
@session_tree.add_session(@session, options, buffer, input, output)
|
||||
@session_tree.add_session(@session, options, buffer, pipe, input, output)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue