Sha256: 7de2e32dc6332e27942ff440ce5ff9c98ab4c5a6bd092f084e27f24382ea9b1a

Contents?: true

Size: 1.54 KB

Versions: 16

Compression:

Stored size: 1.54 KB

Contents

module Rex
module Post
module Meterpreter
module Ui

###
#
# Mixin that is meant to extend the base channel class from meterpreter in a
# manner that adds interactive capabilities.
#
###
module Console::InteractiveChannel

	include Rex::Ui::Interactive

	#
	# Interacts with self.
	#
	def _interact
		# If the channel has a left-side socket, then we can interact with it.
		if (self.lsock)
			self.interactive(true)

			interact_stream(self)

			self.interactive(false)
		else
			print_error("Channel #{self.cid} does not support interaction.")

			self.interacting = false
		end
	end

	#
	# Called when an interrupt is sent.
	#
	def _interrupt
		prompt_yesno("Terminate channel #{self.cid}?")	
	end

	#
	# Suspends interaction with the channel.
	#
	def _suspend
		# Ask the user if they would like to background the session
		if (prompt_yesno("Background channel #{self.cid}?") == true)
			self.interactive(false)

			self.interacting = false
		end
	end

	#
	# Closes the channel like it aint no thang.
	#
	def _interact_complete
		begin
			self.interactive(false)

			self.close
		rescue IOError
		end
	end

	#
	# Reads data from local input and writes it remotely.
	#
	def _stream_read_local_write_remote(channel)
		data = user_input.gets
		return if not data
		self.write(data)
	end

	#
	# Reads from the channel and writes locally.
	#
	def _stream_read_remote_write_local(channel)
		data = self.lsock.sysread(16384)

		user_output.print(data)
	end

	#
	# Returns the remote file descriptor to select on
	#
	def _remote_fd(stream)
		self.lsock
	end

end

end
end
end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
librex-0.0.28 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.27 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.26 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.25 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.23 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.21 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.19 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.17 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.13 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.12 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.7 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.6 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.5 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.4 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.3 lib/rex/post/meterpreter/ui/console/interactive_channel.rb
librex-0.0.1 lib/rex/post/meterpreter/ui/console/interactive_channel.rb