Class: Msf::Sessions::Meterpreter_Python_Python
- Inherits:
-
Meterpreter
- Object
- Rex::Post::Meterpreter::Client
- Meterpreter
- Msf::Sessions::Meterpreter_Python_Python
- Defined in:
- lib/msf/base/sessions/meterpreter_python.rb
Overview
This class creates a platform-specific meterpreter session type
Constant Summary collapse
- ERROR_TYPE_UNKNOWN =
1
- ERROR_TYPE_PYTHON =
2
- ERROR_TYPE_WINDOWS =
3
- PYTHON_ERROR_CRCS =
16-bit CRC-CCITT XMODEM
{ 0x02dd => 'NotImplementedError', 0x049a => 'RuntimeWarning', 0x09ae => 'IndentationError', 0x0bf4 => 'SystemExit', 0x1494 => 'GeneratorExit', 0x1511 => 'ConnectionRefusedError', 0x1765 => 'SyntaxWarning', 0x1f0e => 'SystemError', 0x33b1 => 'StandardError', 0x37b8 => 'IOError', 0x39df => 'PermissionError', 0x39e6 => 'AttributeError', 0x3b70 => 'ChildProcessError', 0x3c93 => 'UserWarning', 0x3ca3 => 'BufferError', 0x3e32 => 'StopIteration', 0x423c => 'NotADirectoryError', 0x42f1 => 'ConnectionError', 0x453b => 'UnboundLocalError', 0x470d => 'LookupError', 0x4cb2 => 'WindowsError', 0x4ecc => 'ResourceWarning', 0x532d => 'UnicodeEncodeError', 0x5dde => 'ConnectionAbortedError', 0x6011 => 'EOFError', 0x637f => 'UnicodeWarning', 0x6482 => 'RuntimeError', 0x6a75 => 'ArithmeticError', 0x6b73 => 'BlockingIOError', 0x70e0 => 'UnicodeDecodeError', 0x72b4 => 'AssertionError', 0x75a1 => 'TabError', 0x77c2 => 'ReferenceError', 0x7a4c => 'FutureWarning', 0x7a78 => 'Warning', 0x7ef9 => 'IsADirectoryError', 0x81dc => 'ConnectionResetError', 0x87fa => 'OSError', 0x8937 => 'KeyError', 0x8a80 => 'SyntaxError', 0x8f3e => 'TypeError', 0x9329 => 'MemoryError', 0x956e => 'ValueError', 0x96a1 => 'OverflowError', 0xa451 => 'InterruptedError', 0xa4d7 => 'FileExistsError', 0xb19a => 'ZeroDivisionError', 0xb27b => 'IndexError', 0xb628 => 'UnicodeError', 0xbb63 => 'TimeoutError', 0xbc91 => 'ImportWarning', 0xc18f => 'BrokenPipeError', 0xc3a0 => 'KeyboardInterrupt', 0xcbab => 'ImportError', 0xcd47 => 'NameError', 0xcd82 => 'ProcessLookupError', 0xdd4a => 'BaseException', 0xe5a3 => 'BytesWarning', 0xe97a => 'FileNotFoundError', 0xe98a => 'PendingDeprecationWarning', 0xf47c => 'DeprecationWarning', 0xf7c6 => 'Exception', 0xfa9d => 'EnvironmentError', 0xfcb4 => 'UnicodeTranslateError', 0xff8d => 'FloatingPointError' }
Constants included from Rex::Post::Meterpreter::PacketDispatcher
Rex::Post::Meterpreter::PacketDispatcher::PACKET_TIMEOUT, Rex::Post::Meterpreter::PacketDispatcher::PING_TIME
Instance Attribute Summary
Attributes inherited from Meterpreter
#base_arch, #base_platform, #console, #max_threads, #rstream, #skip_cleanup, #skip_ssl, #target_id
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
Attributes inherited from Rex::Post::Meterpreter::Client
#alive, #capabilities, #comm_timeout, #commands, #conn_id, #debug_build, #encode_unicode, #expiration, #ext, #ext_aliases, #last_checkin, #parser, #passive_dispatcher, #pivot_session, #response_timeout, #retry_total, #retry_wait, #send_keepalives, #sock, #ssl, #ssl_cert, #target_id, #url
Attributes included from Rex::Post::Meterpreter::PivotContainer
#pivot_listeners, #pivot_sessions
Attributes included from Rex::Post::Meterpreter::PacketDispatcher
#comm_mutex, #dispatcher_thread, #passive_service, #receiver_thread, #recv_queue, #send_queue, #session_guid, #tlv_enc_key, #tlv_log_file, #tlv_log_file_path, #tlv_log_output, #tlv_logging_error_occured, #waiters
Attributes included from Rex::Post::Channel::Container
Instance Method Summary collapse
-
#initialize(rstream, opts = {}) ⇒ Meterpreter_Python_Python
constructor
A new instance of Meterpreter_Python_Python.
- #lookup_error(error_code) ⇒ Object
- #native_arch ⇒ Object
- #supports_ssl? ⇒ Boolean
- #supports_zlib? ⇒ Boolean
Methods inherited from Meterpreter
#_interact, #arch, #binary_suffix, #bootstrap, can_cleanup_files, #cleanup, #create, #desc, #execute_file, #exit, #find_internet_connected_address, #guess_target_platform, #init_ui, #kill, #load_priv, #load_session_info, #load_stdapi, #platform, #queue_cmd, #reset_ui, #run_cmd, #shell_close, #shell_command, #shell_init, #shell_read, #shell_write, #supports_udp?, #tunnel_to_s, #type, type, #update_session_info
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::Comm
Methods included from Msf::Session::Interactive
#_interact, #_interact_complete, #_interrupt, #_suspend, #_usr1, #abort_foreground, #abort_foreground_supported, #cleanup, #comm_channel, #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?, #desc, #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, type, #via_exploit, #via_payload
Methods inherited from Rex::Post::Meterpreter::Client
#add_extension, check_ext_hash, #cleanup_meterpreter, default_timeout, #deregister_extension, #deregister_extension_alias, #dump_extension_tree, #each_extension, #generate_ssl_context, #init_meterpreter, lookup_error, #method_missing, #register_extension_alias, #register_extension_aliases, set_ext_hash, #swap_sock_plain_to_ssl, #swap_sock_ssl_to_plain, #unicode_filter_decode, #unicode_filter_encode
Methods included from Rex::Post::Meterpreter::PivotContainer
#add_pivot_listener, #add_pivot_session, #find_pivot_listener, #find_pivot_session, #initialize_pivots, #remove_pivot_listener, #remove_pivot_session
Methods included from Rex::Post::Meterpreter::PacketDispatcher
#add_response_waiter, #decrypt_inbound_packet, #deregister_inbound_handler, #dispatch_inbound_packet, #initialize_inbound_handlers, #initialize_passive_dispatcher, #initialize_tlv_logging, #keepalive, #log_packet, #log_packet_to_console, #log_packet_to_file, #monitor_socket, #monitor_stop, #notify_response_waiter, #on_passive_request, #pivot_keepalive_start, #receive_packet, #register_inbound_handler, #remove_response_waiter, #send_packet, #send_packet_wait_response, #send_request, #shutdown_passive_dispatcher, #shutdown_tlv_logging
Methods included from Rex::Post::Channel::Container
#add_channel, #find_channel, #initialize_channels, #remove_channel
Constructor Details
#initialize(rstream, opts = {}) ⇒ Meterpreter_Python_Python
Returns a new instance of Meterpreter_Python_Python.
85 86 87 88 89 |
# File 'lib/msf/base/sessions/meterpreter_python.rb', line 85 def initialize(rstream, opts={}) super self.base_platform = 'python' self.base_arch = ARCH_PYTHON end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rex::Post::Meterpreter::Client
Instance Method Details
#lookup_error(error_code) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/msf/base/sessions/meterpreter_python.rb', line 91 def lookup_error(error_code) unknown_error = 'Unknown error' error_type = error_code & 0x0f return unknown_error if error_type == ERROR_TYPE_UNKNOWN error_code &= 0xffff0000 error_code >>= 16 if error_type == ERROR_TYPE_PYTHON python_error = PYTHON_ERROR_CRCS[error_code] return "Python exception: #{python_error}" unless python_error.nil? elsif error_type == ERROR_TYPE_WINDOWS return "Windows error: #{Msf::WindowsError.description(error_code)}" end unknown_error end |
#native_arch ⇒ Object
109 110 111 |
# File 'lib/msf/base/sessions/meterpreter_python.rb', line 109 def native_arch @native_arch ||= self.core.native_arch end |
#supports_ssl? ⇒ Boolean
113 114 115 |
# File 'lib/msf/base/sessions/meterpreter_python.rb', line 113 def supports_ssl? false end |
#supports_zlib? ⇒ Boolean
117 118 119 |
# File 'lib/msf/base/sessions/meterpreter_python.rb', line 117 def supports_zlib? false end |