remove more ring operations
parent
730010aa06
commit
7a95024062
|
@ -217,12 +217,8 @@ protected
|
|||
# shell_write instead of operating on rstream directly.
|
||||
def _interact
|
||||
framework.events.on_session_interact(self)
|
||||
if self.respond_to?(:ring)
|
||||
_interact_ring
|
||||
else
|
||||
_interact_stream
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# :category: Msf::Session::Interactive implementors
|
||||
|
|
|
@ -51,11 +51,6 @@ class MainframeShell < Msf::Sessions::CommandShell
|
|||
# override shell_read to include decode of cp1047
|
||||
#
|
||||
def shell_read(length=-1, timeout=1)
|
||||
#mfimpl
|
||||
if self.respond_to?(:ring)
|
||||
return Rex::Text.from_ibm1047(shell_read_ring(length,timeout))
|
||||
end
|
||||
|
||||
begin
|
||||
rv = Rex::Text.from_ibm1047(rstream.get_once(length, timeout))
|
||||
framework.events.on_session_output(self, rv) if rv
|
||||
|
@ -104,46 +99,5 @@ class MainframeShell < Msf::Sessions::CommandShell
|
|||
|
||||
protected
|
||||
|
||||
##
|
||||
#
|
||||
# _interact_ring overridden to include decoding of cp1047 data
|
||||
#
|
||||
def _interact_ring
|
||||
begin
|
||||
rdr = framework.threads.spawn("RingMonitor", false) do
|
||||
seq = nil
|
||||
|
||||
while self.interacting
|
||||
# Look for any pending data from the remote ring
|
||||
nseq,data = ring.read_data(seq)
|
||||
|
||||
# Update the sequence number if necessary
|
||||
seq = nseq || seq
|
||||
|
||||
# Write output to the local stream if successful
|
||||
user_output.print(Rex::Text.from_ibm1047(data)) if data
|
||||
|
||||
begin
|
||||
# Wait for new data to arrive on this session
|
||||
ring.wait(seq)
|
||||
rescue EOFError => e
|
||||
print_error("EOFError: #{e.class}: #{e}")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
while self.interacting
|
||||
# Look for any pending input or errors from the local stream
|
||||
sd = Rex::ThreadSafe.select([ _local_fd ], nil, [_local_fd], 5.0)
|
||||
|
||||
# Write input to the ring's input mechanism
|
||||
shell_write(user_input.gets) if sd
|
||||
end
|
||||
ensure
|
||||
rdr.kill
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,12 +35,8 @@ protected
|
|||
#
|
||||
def _interact
|
||||
framework.events.on_session_interact(self)
|
||||
if self.respond_to?(:ring)
|
||||
interact_ring(ring)
|
||||
else
|
||||
interact_stream(rstream)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -216,49 +216,6 @@ protected
|
|||
end
|
||||
|
||||
|
||||
#
|
||||
# Interacts between a local stream and a remote ring buffer. This has to use
|
||||
# a secondary thread to prevent the select on the local stream from blocking
|
||||
#
|
||||
def interact_ring(ring)
|
||||
begin
|
||||
|
||||
rdr = Rex::ThreadFactory.spawn("RingMonitor", false) do
|
||||
seq = nil
|
||||
while self.interacting
|
||||
|
||||
# Look for any pending data from the remote ring
|
||||
nseq,data = ring.read_data(seq)
|
||||
|
||||
# Update the sequence number if necessary
|
||||
seq = nseq || seq
|
||||
|
||||
# Write output to the local stream if successful
|
||||
user_output.print(data) if data
|
||||
|
||||
# Wait for new data to arrive on this session
|
||||
ring.wait(seq)
|
||||
end
|
||||
end
|
||||
|
||||
while self.interacting
|
||||
|
||||
# Look for any pending input from the local stream
|
||||
sd = Rex::ThreadSafe.select([ _local_fd ], nil, [_local_fd], 5.0)
|
||||
|
||||
# Write input to the ring's input mechanism
|
||||
if sd
|
||||
data = user_input.gets
|
||||
ring.put(data)
|
||||
end
|
||||
end
|
||||
|
||||
ensure
|
||||
rdr.kill
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Installs a signal handler to monitor suspend signal notifications.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue