zelos.file_system module

class zelos.file_system.PathTranslator(file_prefix)

Bases: object

PathTranslator manages the relationship between paths in the emulated environment. It will mimic whatever path it is initialized with.

is_absolute_path(emulated_path)
change_working_directory(emulated_path)
add_file(real_path, emulated_path=None)
mount_folder(real_path, emulated_path=None)
emulated_path_to_host_path(emulated_path: str) → Optional[str]
get_sandbox_path(emulated_path)
class zelos.file_system.FileSystem(z, hook_manager, persistent_sandbox_path: str = None)

Bases: zelos.file_system.PathTranslator

property handles
setup(file_prefix)
create_file(emulated_path)

Creates file with the given name. Returns the handle used to access it

get_file_by_name(filename)
get_filename(handle)
get_file_offset(handle)
set_file_offset(handle, new_offset)
create_file_mapping(handle)
get_file_mapping(handle)
open_sandbox_file(orig_filename: str, create_if_not_exists: bool = False)
write_to_sandbox(orig_filename, data, offset=0)
list_dir(orig_filename)
open_library(orig_filename)
find_library(orig_filename)

Second return value is True if this was a library found in the library path.

unsafe_open(filename, *args, **kwargs)

Ensures that the file opened by this call is closed upon call to Engine.close. This function does not validate that the filepath is restricted appropriately, and thus should not be used in syscalls, or anywhere else that executing code has control over the inputs to the binary.