zelos.handles.base_handles module¶
-
class
zelos.handles.base_handles.
Handle
(name, parent_thread, access=0)¶ Bases:
object
-
close
() → None¶ Closes an instance of this handle, maintaining the number of references to the underlying object.
-
cleanup
() → None¶ Override this if there is an action that needs to be taken when there are no more references to the underlying object.
-
category
() → str¶ - Returns
The type of object this handle represents.
-
-
class
zelos.handles.base_handles.
FileHandle
(name, file_system, parent_thread, access=0, is_dir=False, file=None, close_on_cleanup=True)¶ Bases:
zelos.handles.base_handles.Handle
-
truncate
(size) → None¶
-
size
() → int¶
-
tell
() → int¶
-
seek
(offset: int, whence: int = 0) → None¶
-
write
(data: bytes) → int¶
-
read
(size: int) → bytes¶
-
cleanup
() → None¶ Override this if there is an action that needs to be taken when there are no more references to the underlying object.
-
-
class
zelos.handles.base_handles.
SocketHandle
(name, parent_thread, socket, access=0)¶ Bases:
zelos.handles.base_handles.Handle
-
cleanup
() → None¶ Override this if there is an action that needs to be taken when there are no more references to the underlying object.
-
-
class
zelos.handles.base_handles.
RegistryKeyHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
SectionHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
SymbolicLinkObjectHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
WorkerFactoryHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
ObjectHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
KeyedEventHandle
(name, parent_thread, access=0, attributes=None)¶
-
class
zelos.handles.base_handles.
ProcessHandle
(name, parent_thread, pid, access=0, attributes=None, flags=None)¶
-
class
zelos.handles.base_handles.
ThreadHandle
(name, parent_thread, pid, tid, access=0, attributes=None, flags=None)¶
-
class
zelos.handles.base_handles.
PipeInHandle
(name, pipe, parent_thread=None, access=0)¶ Bases:
zelos.handles.base_handles.Handle
-
write
(data: bytes) → int¶
-
cleanup
() → None¶ Override this if there is an action that needs to be taken when there are no more references to the underlying object.
-
-
class
zelos.handles.base_handles.
PipeOutHandle
(name, pipe, parent_thread=None, access=0)¶ Bases:
zelos.handles.base_handles.Handle
-
read
(size: int) → bytes¶
-
cleanup
() → None¶ Override this if there is an action that needs to be taken when there are no more references to the underlying object.
-
-
class
zelos.handles.base_handles.
StreamHandle
(name, parent_thread, access=0)¶
-
class
zelos.handles.base_handles.
StdIn
(parent_thread='unknown')¶ Bases:
zelos.handles.base_handles.StreamHandle
-
read
(size: int) → bytes¶
-
-
class
zelos.handles.base_handles.
StdOut
(parent_thread='unknown')¶ Bases:
zelos.handles.base_handles.StreamHandle
-
write
(data)¶
-
-
class
zelos.handles.base_handles.
StdErr
(parent_thread='unknown')¶ Bases:
zelos.handles.base_handles.StreamHandle
-
write
(data)¶
-
-
class
zelos.handles.base_handles.
Handles
(processes, hook_manager, file_system)¶ Bases:
object
-
add_handle
(handle, handle_num=None, pid=None) → int¶ Returns the handle id for the handle
-
get
(handle_num: int, pid: Optional[int] = None) → Optional[zelos.handles.base_handles.Handle]¶ Return the handle object with the given index, or None if it does not exist
-
exists
(handle_num: int, pid: Optional[int] = None) → bool¶ Returns true if the given handle_num already exists for the pid
-
new
(T, name, access=0, handle_num=None)¶ Used to create handles that are not one we already support
-
new_file
(name, access=0, handle_num=None, is_dir=False, file=None, pid=None, close_on_cleanup=True)¶
-
new_socket
(name, socket, access=0, handle_num=None)¶
-
new_regkey
(name, access=0, attributes=None, handle_num=None)¶
-
new_process
(name, pid, attributes, parent_thread='unknown', access=0, handle_num=None, flags=None)¶
-
new_thread
(name, pid, tid, attributes, parent_thread='unknown', access=0, handle_num=None, flags=None)¶
-
new_pipe
(name, access=0)¶
-
get_by_name
(name: str, pid: Optional[int] = None) → Optional[int]¶ Gets the numeric identifier for the first handle that has the specified name.
- Parameters
name – The name of the handle to retrieve.
pid – The id of the process to get the handle from. Defaults to None (all processes).
- Returns
The handle number corresponding to the specified name if one exists. If no such handle exists, returns None.
-
get_by_type
(class_type: type, pid: Optional[int] = None) → List[zelos.handles.base_handles.Handle]¶ Returns all handles of the given type.
- Parameters
class_type – Specifies the type that all returned handles should be an instance of.
pid – The id of the process to get the handle from. Defaults to None (all processes).
- Returns
All handles that are an instance of the specified type.
-
get_by_parent_thread
(parent_thread_name: str) → List[Tuple[int, zelos.handles.base_handles.Handle]]¶ Gets all handles created by the specified thread
- Parameters
parent_thread_name – Restricts the handles given back to those created by the thread with this name.
- Returns
A list of tuples containing the handle num and handle of all the handles created by the parent thread.
-
close
(handle_num: int, pid: Optional[int] = None) → None¶ Close this handle. If there are more references to the underlying object, it will remain open and only decrement the reference count.
- Parameters
handle_num – The handle_id of the handle you want to close
pid – The process you want to edit the handles of. Defaults to the current process.
-
close_all
(pid: Optional[int] = None) → None¶ Closes all handles present in the specified process.
- Parameters
pid – The pid of the process to close all handles of. Defaults to all handles in all processes.
-