Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/base/sessions/meterpreter_python.rb
Views: 11784
# -*- coding: binary -*-123module Msf4module Sessions56###7#8# This class creates a platform-specific meterpreter session type9#10###11class Meterpreter_Python_Python < Msf::Sessions::Meterpreter12ERROR_TYPE_UNKNOWN = 113ERROR_TYPE_PYTHON = 214ERROR_TYPE_WINDOWS = 315# 16-bit CRC-CCITT XMODEM16PYTHON_ERROR_CRCS = {170x02dd => 'NotImplementedError',180x049a => 'RuntimeWarning',190x09ae => 'IndentationError',200x0bf4 => 'SystemExit',210x1494 => 'GeneratorExit',220x1511 => 'ConnectionRefusedError',230x1765 => 'SyntaxWarning',240x1f0e => 'SystemError',250x33b1 => 'StandardError',260x37b8 => 'IOError',270x39df => 'PermissionError',280x39e6 => 'AttributeError',290x3b70 => 'ChildProcessError',300x3c93 => 'UserWarning',310x3ca3 => 'BufferError',320x3e32 => 'StopIteration',330x423c => 'NotADirectoryError',340x42f1 => 'ConnectionError',350x453b => 'UnboundLocalError',360x470d => 'LookupError',370x4cb2 => 'WindowsError',380x4ecc => 'ResourceWarning',390x532d => 'UnicodeEncodeError',400x5dde => 'ConnectionAbortedError',410x6011 => 'EOFError',420x637f => 'UnicodeWarning',430x6482 => 'RuntimeError',440x6a75 => 'ArithmeticError',450x6b73 => 'BlockingIOError',460x70e0 => 'UnicodeDecodeError',470x72b4 => 'AssertionError',480x75a1 => 'TabError',490x77c2 => 'ReferenceError',500x7a4c => 'FutureWarning',510x7a78 => 'Warning',520x7ef9 => 'IsADirectoryError',530x81dc => 'ConnectionResetError',540x87fa => 'OSError',550x8937 => 'KeyError',560x8a80 => 'SyntaxError',570x8f3e => 'TypeError',580x9329 => 'MemoryError',590x956e => 'ValueError',600x96a1 => 'OverflowError',610xa451 => 'InterruptedError',620xa4d7 => 'FileExistsError',630xb19a => 'ZeroDivisionError',640xb27b => 'IndexError',650xb628 => 'UnicodeError',660xbb63 => 'TimeoutError',670xbc91 => 'ImportWarning',680xc18f => 'BrokenPipeError',690xc3a0 => 'KeyboardInterrupt',700xcbab => 'ImportError',710xcd47 => 'NameError',720xcd82 => 'ProcessLookupError',730xdd4a => 'BaseException',740xe5a3 => 'BytesWarning',750xe97a => 'FileNotFoundError',760xe98a => 'PendingDeprecationWarning',770xf47c => 'DeprecationWarning',780xf7c6 => 'Exception',790xfa9d => 'EnvironmentError',800xfcb4 => 'UnicodeTranslateError',810xff8d => 'FloatingPointError'82}8384def initialize(rstream, opts={})85super86self.base_platform = 'python'87self.base_arch = ARCH_PYTHON88end8990def lookup_error(error_code)91unknown_error = 'Unknown error'92error_type = error_code & 0x0f93return unknown_error if error_type == ERROR_TYPE_UNKNOWN9495error_code &= 0xffff000096error_code >>= 169798if error_type == ERROR_TYPE_PYTHON99python_error = PYTHON_ERROR_CRCS[error_code]100return "Python exception: #{python_error}" unless python_error.nil?101elsif error_type == ERROR_TYPE_WINDOWS102return "Windows error: #{Msf::WindowsError.description(error_code)}"103end104105unknown_error106end107108def native_arch109@native_arch ||= self.core.native_arch110end111112def supports_ssl?113false114end115116def supports_zlib?117false118end119end120121end122end123124125