Class: Msf::Sessions::PowerShell
- Inherits:
-
CommandShell
- Object
- CommandShell
- Msf::Sessions::PowerShell
- Includes:
- Mixin
- Defined in:
- lib/msf/base/sessions/powershell.rb
Defined Under Namespace
Modules: Mixin
Instance Attribute Summary
Attributes inherited from CommandShell
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.
-
#platform ⇒ Object
Returns the session platform.
-
#process_autoruns(datastore) ⇒ Object
Execute any specified auto-run scripts for this session.
Methods included from Mixin
Methods inherited from CommandShell
#_file_transfer, #_interact, #_interact_stream, #abort_foreground_supported, binary_exists, #binary_exists, #bootstrap, #cleanup, #cmd_background, #cmd_background_help, #cmd_download, #cmd_download_help, #cmd_help, #cmd_help_help, #cmd_irb, #cmd_irb_help, #cmd_pry, #cmd_pry_help, #cmd_resource, #cmd_resource_help, #cmd_sessions, #cmd_sessions_help, #cmd_shell, #cmd_shell_help, #cmd_source, #cmd_source_help, #cmd_upload, #cmd_upload_help, #commands, #docs_dir, #execute_file, #initialize, #run_builtin_cmd, #run_single, #shell_close, #shell_command, #shell_init, #shell_read, #shell_write, #type
Methods included from Rex::Ui::Text::Resource
Methods included from Scriptable
#execute_file, #execute_script, included, #legacy_script_to_post_module
Methods included from Msf::Session::Provider::SingleCommandShell
#command_termination, #set_is_echo_shell, #shell_close, #shell_command_token, #shell_command_token_base, #shell_command_token_unix, #shell_command_token_win32, #shell_init, #shell_read, #shell_read_until_token, #shell_write, #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, #run_cmd, #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, #type, #via_exploit, #via_payload
Constructor Details
This class inherits a constructor from Msf::Sessions::CommandShell
Class Method Details
.can_cleanup_files ⇒ Object
66 67 68 |
# File 'lib/msf/base/sessions/powershell.rb', line 66 def self.can_cleanup_files true end |
.type ⇒ Object
Returns the type of session.
62 63 64 |
# File 'lib/msf/base/sessions/powershell.rb', line 62 def self.type 'powershell' end |
Instance Method Details
#desc ⇒ Object
Returns the session description.
80 81 82 |
# File 'lib/msf/base/sessions/powershell.rb', line 80 def desc 'Powershell session' end |
#platform ⇒ Object
Returns the session platform.
73 74 75 |
# File 'lib/msf/base/sessions/powershell.rb', line 73 def platform 'windows' end |
#process_autoruns(datastore) ⇒ Object
Execute any specified auto-run scripts for this session
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/msf/base/sessions/powershell.rb', line 44 def process_autoruns(datastore) # Read the username and hostname from the initial banner initial_output = shell_read(-1, 2) if initial_output =~ /running as user ([^\s]+) on ([^\s]+)/ username = Regexp.last_match(1) hostname = Regexp.last_match(2) self.info = "#{username} @ #{hostname}" elsif initial_output self.info = initial_output.gsub(/[\r\n]/, ' ') end # Call our parent class's autoruns processing method super end |