rpcclient
rpcclient.allocated
rpcclient.client
- class rpcclient.client.Client(sock, sysname: str, arch: <Enum <FormatField>>, create_socket_cb: ~typing.Callable)[source]
Bases:
objectMain client interface to access remote rpcserver
- DEFAULT_ARGV = ['/bin/sh']
- DEFAULT_ENVP = []
- property arch
get remote arch
- call(address: int, argv: List[int] = None, return_float64=False, return_float32=False, return_float16=False, return_raw=False, va_list_index: int = 65535) Symbol[source]
call a remote function and retrieve its return value as Symbol object
- dlclose(lib: int)[source]
call dlclose() at remote and return its handle. see the man page for more details.
- dlopen(filename: str, mode: int) Symbol[source]
call dlopen() at remote and return its handle. see the man page for more details.
- dlsym(lib: int, symbol_name: str)[source]
call dlsym() at remote and return its handle. see the man page for more details.
- property environ: List[str]
- property errno
- property last_error
get info about the last occurred error
- property pid
- spawn(argv: ~typing.List[str] = None, envp: ~typing.List[str] = None, stdin: ~rpcclient.client.io_or_str = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>, stdout=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, raw_tty=False, background=False) SpawnResult[source]
spawn a new process and forward its stdin, stdout & stderr
- Parameters:
argv – argv of the process to be executed
envp – envp of the process to be executed
stdin – either a file object to read from OR a string
stdout – a file object to write both stdout and stderr to. None if background is requested
raw_tty – should enable raw tty mode
background – should execute process in background
- Returns:
a SpawnResult. error is None if background is requested
- property uname
get the utsname struct from remote
- class rpcclient.client.ProtocolDirent(d_inode: int, d_type: int, d_name: str, lstat: rpcclient.client.ProtocolDitentStat, stat: rpcclient.client.ProtocolDitentStat)[source]
Bases:
object- d_inode: int
- d_name: str
- d_type: int
- lstat: ProtocolDitentStat
- stat: ProtocolDitentStat
- class rpcclient.client.ProtocolDitentStat(errno: int, st_dev: int, st_mode: int, st_nlink: int, st_ino: int, st_uid: int, st_gid: int, st_rdev: int, st_size: int, st_blocks: int, st_blksize: int, st_atime: int, st_mtime: int, st_ctime: int)[source]
Bases:
object- errno: int
- st_atime: int
- st_blksize: int
- st_blocks: int
- st_ctime: int
- st_dev: int
- st_gid: int
- st_ino: int
- st_mode: int
- st_mtime: int
- st_nlink: int
- st_rdev: int
- st_size: int
- st_uid: int
rpcclient.client_factory
- rpcclient.client_factory.create_client(create_socket_cb: Callable) Client | IosClient | MacosClient | LinuxClient[source]
- rpcclient.client_factory.create_local() Client | IosClient | MacosClient | LinuxClient[source]
- rpcclient.client_factory.create_tcp_client(hostname: str, port: int = 5910) Client | IosClient | MacosClient | LinuxClient[source]
rpcclient.exceptions
- exception rpcclient.exceptions.ArgumentError[source]
Bases:
RpcClientExceptionat least one of the supplied arguments for a given function was invalid
- exception rpcclient.exceptions.BadReturnValueError[source]
Bases:
RpcClientExceptionremote c function returned an error
- exception rpcclient.exceptions.CfSerializationError[source]
Bases:
RpcClientExceptionfailed to encode/decode a cfobject into/from a python object
- exception rpcclient.exceptions.ElementNotFoundError[source]
Bases:
RpcClientExceptionFailed to find element
- exception rpcclient.exceptions.FailedToConnectError[source]
Bases:
RpcClientExceptionfailed to connect to rpcserver
- exception rpcclient.exceptions.FirstElementNotFoundError[source]
Bases:
ElementNotFoundErrorFailed to find the first element
- exception rpcclient.exceptions.GettingObjectiveCClassError[source]
Bases:
RpcClientExceptionfailed to create an objc class wrapper for a given object
- exception rpcclient.exceptions.HarGlobalNotFoundError[source]
Bases:
RpcClientExceptionFailed to find Harlogger global
- exception rpcclient.exceptions.InvalidServerVersionMagicError[source]
Bases:
RpcClientExceptionserver handshake failed due to an invalid magic
- exception rpcclient.exceptions.LastElementNotFoundError[source]
Bases:
ElementNotFoundErrorFailed to find the last element
- exception rpcclient.exceptions.MissingLibraryError[source]
Bases:
RpcClientExceptiona required library could not be found
- exception rpcclient.exceptions.NoEntitlementsError[source]
Bases:
RpcClientExceptionbinary contains no entitlements
- exception rpcclient.exceptions.NoSuchActivityError[source]
Bases:
RpcClientException
- exception rpcclient.exceptions.NoSuchPreferenceError[source]
Bases:
RpcClientExceptionattempt to read a preference data which doesn’t exist
- exception rpcclient.exceptions.ProcessSymbolAbsentError[source]
Bases:
RpcClientExceptiontrying to access a symbol which is not exported from any library currently loaded into the process’s memory
- exception rpcclient.exceptions.RpcAccessibilityTurnedOffError[source]
Bases:
BadReturnValueErrorApplication AX and Automation is turned off
- exception rpcclient.exceptions.RpcAppleScriptError[source]
Bases:
BadReturnValueErrorFailed to execute given AppleScript
- exception rpcclient.exceptions.RpcBrokenPipeError[source]
Bases:
BadReturnValueErrorRPC version for BrokenPipeError (errno = EPIPE)
- exception rpcclient.exceptions.RpcConnectionRefusedError[source]
Bases:
BadReturnValueErrorRPC version for ConnectionRefusedError (errno = ECONNREFUSED)
- exception rpcclient.exceptions.RpcFailedLaunchingAppError[source]
Bases:
BadReturnValueErrorFailed to launch application
- exception rpcclient.exceptions.RpcFailedToPlayError[source]
Bases:
BadReturnValueErrorAn attempt to play has failed
- exception rpcclient.exceptions.RpcFailedToRecordError[source]
Bases:
BadReturnValueErrorAn attempt to record has failed
- exception rpcclient.exceptions.RpcFileExistsError[source]
Bases:
BadReturnValueErrorRPC version for FileExistsError (errno = EEXIST)
- exception rpcclient.exceptions.RpcFileNotFoundError[source]
Bases:
BadReturnValueErrorRPC version for FileNotFoundError (errno = ENOENTRY)
- exception rpcclient.exceptions.RpcIsADirectoryError[source]
Bases:
BadReturnValueErrorRPC version for IsADirectoryError (errno = ENOTEMPTY)
- exception rpcclient.exceptions.RpcNotADirectoryError[source]
Bases:
BadReturnValueErrorRPC version for NotADirectoryError (errno = ENOTDIR)
- exception rpcclient.exceptions.RpcNotEmptyError[source]
Bases:
BadReturnValueErrorraised when errno = ENOTEMPTY
- exception rpcclient.exceptions.RpcPermissionError[source]
Bases:
BadReturnValueErrorRPC version for PermissionError (errno = EPERM)
Bases:
BadReturnValueErrorraised when errno = EAGAIN
- exception rpcclient.exceptions.RpcSetDeveloperModeError[source]
Bases:
BadReturnValueErrorFailed to set Developer Mode
- exception rpcclient.exceptions.RpcXpcError[source]
Bases:
BadReturnValueErrorXPC-related error
- exception rpcclient.exceptions.RpcXpcSerializationError[source]
Bases:
RpcXpcErrorFailed to serialize/deserialize XPC message
- exception rpcclient.exceptions.ServerDiedError[source]
Bases:
RpcClientExceptionserver became disconnected during an operation
- exception rpcclient.exceptions.SpawnError[source]
Bases:
RpcClientExceptionfailed to spawn a child process
- exception rpcclient.exceptions.SymbolAbsentError[source]
Bases:
RpcClientExceptiontrying to access a symbol which is not exported from any library currently loaded into the server’s memory
- exception rpcclient.exceptions.UnrecognizedSelectorError[source]
Bases:
RpcClientExceptiontried to access a non-existing objc object selector
rpcclient.fs
- class rpcclient.fs.DirEntry(path, entry, client)[source]
Bases:
object- property name: str
- property path: str
- class rpcclient.fs.File(client, fd: int)[source]
Bases:
Allocated- CHUNK_SIZE = 65536
- class rpcclient.fs.Fs(client)[source]
Bases:
objectfilesystem utils
- chmod(path: str, mode: int, recursive=False)[source]
chmod(path, mode) at remote. read man for more details.
- chown(path: str, uid: int, gid: int, recursive=False)[source]
chmod(path, mode) at remote. read man for more details.
- link(src: str, dst: str) int[source]
link(src, dst) - hardlink at remote. read man for more details.
- mkdir(path: str, mode: int = 511, parents=False, exist_ok=False)[source]
mkdir(path, mode) at remote. read man for more details.
- open(file: str, mode: str, access: int = 511) File[source]
call open(file, mode, access) at remote and get a context manager file object :param file: filename to be opened :param mode: one of:
‘r’ - read only ‘r+’ - read and write. exception if file doesn’t exist ‘rw’ - read and write. create if it doesn’t exist. also truncate. ‘w’ - write only. create if it doesn’t exist. also truncate. ‘w+’ - read and write. create if doesn’t exist.
- Parameters:
access – access mode as octal value
- Returns:
a context manager file object
- pwd() str[source]
calls getcwd(buf, size_t) and prints current path. with the special values NULL, 0 the buffer is allocated dynamically
rpcclient.lief
rpcclient.network
- class rpcclient.network.Hostentry(name, aliases, addresses)
Bases:
tuple- addresses
Alias for field number 2
- aliases
Alias for field number 1
- name
Alias for field number 0
- class rpcclient.network.Interface(name, address, netmask, broadcast)
Bases:
tuple- address
Alias for field number 1
- broadcast
Alias for field number 3
- name
Alias for field number 0
- netmask
Alias for field number 2
- class rpcclient.network.Network(client)[source]
Bases:
object- socket(family=2, type=1, proto=0) int[source]
socket(family, type, proto) at remote. read man for more details.
- class rpcclient.network.Socket(client, fd: int)[source]
Bases:
Allocated- CHUNK_SIZE = 1024
- recv(size: int = 1024, flags: int = 0) bytes[source]
recv() at remote. read man for more details.
- Parameters:
size – chunk size
flags – flags for recv() syscall. MSG_NOSIGNAL will always be added
- Returns:
received bytes
rpcclient.processes
rpcclient.protocol
rpcclient.symbol
- class rpcclient.symbol.Symbol[source]
Bases:
intwrapper for a remote symbol object
- PROXY_METHODS = ['peek', 'poke']
- property c_bool: bool
cast to c_bool
- property c_int16: int
cast to c_int16
- property c_int32: int
cast to c_int32
- property c_int64: int
cast to c_int64
- property c_uint16: int
cast to c_uint16
- property c_uint32: int
cast to c_uint32
- property c_uint64: int
cast to c_uint64
- change_item_size(new_item_size: int)[source]
Temporarily change item size :param new_item_size: Temporary item size
- classmethod create(value: int, client)[source]
Create a Symbol object. :param value: Symbol address. :param rpcclient.darwin_client.Client client: client. :return: Symbol object. :rtype: Symbol
- property dl_info: Container
- property filename: str
- property name: str
rpcclient.symbols_jar
rpcclient.sysctl
- class rpcclient.sysctl.CTL(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum- DEBUG = 5
- HW = 6
- KERN = 1
- MACHDEP = 7
- MAXID = 9
- NET = 4
- UNSPEC = 0
- USER = 8
- VFS = 3
- VM = 2
- class rpcclient.sysctl.KERN(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum- AFFINITY = 43
- AIOMAX = 46
- AIOPROCMAX = 47
- AIOTHREADS = 48
- ARGMAX = 8
- BOOTFILE = 28
- BOOTTIME = 21
- CHECKOPENEVT = 70
- CLASSIC = 44
- CLASSICHANDLER = 45
- CLOCKRATE = 12
- COREDUMP = 51
- COREFILE = 50
- DOMAINNAME = 22
- DUMMY = 33
- DUMPDEV = 31
- EXEC = 45
- FILE = 15
- HOSTID = 11
- HOSTNAME = 10
- IPC = 32
- JOB_CONTROL = 19
- KDEBUG = 24
- LOGSIGEXIT = 36
- LOW_PRI_DELAY = 57
- LOW_PRI_WINDOW = 56
- MAXFILES = 7
- MAXFILESPERPROC = 29
- MAXID = 72
- MAXPROC = 6
- MAXPROCPERUID = 30
- MAXVNODES = 5
- NETBOOT = 40
- NGROUPS = 18
- NISDOMAINNAME = 22
- NTP_PLL = 27
- NX_PROTECTION = 60
- OSRELDATE = 26
- OSRELEASE = 2
- OSREV = 3
- OSTYPE = 1
- OSVERSION = 65
- POSIX = 58
- POSIX1 = 17
- PROC = 14
- PROCARGS = 38
- PROCARGS2 = 49
- PROCDELAYTERM = 53
- PROCNAME = 62
- PROF = 16
- PS_STRINGS = 34
- RAGEVNODE = 68
- SAFEBOOT = 66
- SAVED_IDS = 20
- SECURELVL = 9
- SHREG_PRIVATIZABLE = 54
- SPECULATIVE_READS = 64
- SUGID_COREDUMP = 52
- SYMFILE = 37
- SYSV = 42
- TFP = 61
- THALTSTACK = 63
- THREADNAME = 71
- TRANSLATE = 44
- UPDATEINTERVAL = 25
- USRSTACK32 = 35
- USRSTACK64 = 59
- VERSION = 4
- VNODE = 13
- class rpcclient.sysctl.Sysctl(client)[source]
Bases:
objectsysctl utils. read man page for sysctl(3) for more details
- get(ctl: CTL, kern: KERN, arg: int = None, size=262144) bytes[source]
call sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) on remote
- set(ctl: CTL, kern: KERN, oldp: DarwinSymbol, oldenp: DarwinSymbol, arg: int = None)[source]
call sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) on remote