Class: Msf::Sessions::TTY
- Inherits:
-
Object
- Object
- Msf::Sessions::TTY
- Defined in:
- lib/msf/base/sessions/tty.rb
Overview
This class provides basic interaction with a command shell on the remote endpoint. This session is initialized with a stream that will be used as the pipe for reading and writing the command shell.
Instance Attribute Summary
Attributes included from Msf::Session::Interactive
Attributes included from Rex::Ui::Interactive
#completed, #interacting, #next_session, #on_command_proc, #on_print_proc, #on_run_command_error_proc, #orig_suspend, #orig_usr1, #orig_winch
Attributes included from Rex::Ui::Subscriber::Input
Attributes included from Rex::Ui::Subscriber::Output
Attributes included from Msf::Session
#alive, #db_record, #exploit, #exploit_datastore, #exploit_task, #exploit_uuid, #framework, #info, #machine_id, #payload_uuid, #routes, #sid, #sname, #target_host, #target_port, #username, #uuid, #via, #workspace
Attributes included from Framework::Offspring
Class Method Summary collapse
- .can_cleanup_files ⇒ Object
-
.type ⇒ Object
Returns the type of session.
Instance Method Summary collapse
-
#desc ⇒ Object
Returns the session description.
- #run_cmd(cmd) ⇒ Object
-
#shell_close ⇒ Object
Closes the shell.
-
#shell_init ⇒ Object
The shell will have been initialized by default.
-
#shell_read(length = nil) ⇒ Object
Read from the command shell.
-
#shell_write(buf) ⇒ Object
Writes to the command shell.
-
#type ⇒ Object
Calls the class method.
Methods included from Msf::Session::Provider::SingleCommandShell
#command_termination, #set_is_echo_shell, #shell_command_token, #shell_command_token_base, #shell_command_token_unix, #shell_command_token_win32, #shell_read_until_token, #to_cmd
Methods included from Msf::Session::Basic
Methods included from Msf::Session::Interactive
#_interact, #_interact_complete, #_interrupt, #_suspend, #_usr1, #abort_foreground, #abort_foreground_supported, #cleanup, #comm_channel, #initialize, #interactive?, #kill, #tunnel_local, #tunnel_peer, #user_want_abort?
Methods included from Rex::Ui::Interactive
#_interact, #_interact_complete, #_interrupt, #_local_fd, #_remote_fd, #_stream_read_local_write_remote, #_stream_read_remote_write_local, #_suspend, #_winch, #detach, #handle_suspend, #handle_usr1, #handle_winch, #interact, #interact_stream, #prompt, #prompt_yesno, #restore_suspend, #restore_usr1, #restore_winch
Methods included from Rex::Ui::Subscriber
Methods included from Rex::Ui::Subscriber::Input
Methods included from Rex::Ui::Subscriber::Output
#flush, #print, #print_blank_line, #print_error, #print_good, #print_line, #print_status, #print_warning
Methods included from Msf::Session
#alive?, #cleanup, #comm_channel, #dead?, #initialize, #inspect, #interactive?, #kill, #log_file_name, #log_source, #name, #name=, #register?, #session_host, #session_host=, #session_port, #session_port=, #session_type, #set_from_exploit, #set_via, #tunnel_local, #tunnel_peer, #tunnel_to_s, #via_exploit, #via_payload
Class Method Details
.can_cleanup_files ⇒ Object
84 85 86 |
# File 'lib/msf/base/sessions/tty.rb', line 84 def self.can_cleanup_files true end |
.type ⇒ Object
Returns the type of session.
29 30 31 |
# File 'lib/msf/base/sessions/tty.rb', line 29 def self.type "tty" end |
Instance Method Details
#desc ⇒ Object
Returns the session description.
36 37 38 |
# File 'lib/msf/base/sessions/tty.rb', line 36 def desc "Interactive TTY" end |
#run_cmd(cmd) ⇒ Object
40 41 42 43 |
# File 'lib/msf/base/sessions/tty.rb', line 40 def run_cmd(cmd) shell_write(cmd) return rstream.get end |
#shell_close ⇒ Object
Closes the shell.
80 81 82 |
# File 'lib/msf/base/sessions/tty.rb', line 80 def shell_close() rstream.close end |
#shell_init ⇒ Object
The shell will have been initialized by default.
54 55 56 |
# File 'lib/msf/base/sessions/tty.rb', line 54 def shell_init return true end |
#shell_read(length = nil) ⇒ Object
Read from the command shell.
61 62 63 64 65 66 67 68 |
# File 'lib/msf/base/sessions/tty.rb', line 61 def shell_read(length = nil) if length.nil? rv = rstream.get else rv = rstream.read(length) end return rv end |
#shell_write(buf) ⇒ Object
Writes to the command shell.
73 74 75 |
# File 'lib/msf/base/sessions/tty.rb', line 73 def shell_write(buf) rstream.write(buf) end |
#type ⇒ Object
Calls the class method.
47 48 49 |
# File 'lib/msf/base/sessions/tty.rb', line 47 def type self.class.type end |