elfcall package
Submodules
elfcall.client module
elfcall.logger module
elfcall.version module
elfcall.main.client module
- class elfcall.main.client.BinaryInterface(binary=None, quiet=False, skipdirs=None)[source]
Bases:
object
Parse binaries to determine symbols needed and interfaces
- find_library(name, paths, match_to=None, use_versions=False)[source]
Given a listing of paths, look for a library by name
- gen(binary=None, fmt=None, secure=False, no_default_libs=False)[source]
Generate a graph of symbols (e.g., where everything is found)
- gen_output(binary=None, secure=False, no_default_libs=False, ld_library_paths=None, use_versions=False)[source]
Generate a graph of symbols (e.g., where everything is found)
- parse_binary(binary, return_missing=False, use_versions=False)[source]
Given a binary, figure out how the linker would find symbols
elfcall.main.ld module
- class elfcall.main.ld.LibraryParser[source]
Bases:
object
- property default_paths
- in_default_path(path)[source]
In secure mode, we only allow a path from ld preload given that it’s in a default path.
- property ld_preload
Parse LD_PRELOAD from the environment and (rarely) a system file
- parse(secure=False, no_default_libs=False)[source]
Parse paths. We define secure and no default libs here, and arguably could support defining it in the init instead.
elfcall.main.elf module
- class elfcall.main.elf.ElfFile(realpath, fullpath=None, use_versions=False)[source]
Bases:
object
- property arch
- property elfcls
- property endian
- property gnu_debuglink
Look for .gnu_debuglink
- property is_stripped
Guess if an ELF is stripped based on missing DT_NEEDED and symbols.
- matches(libelf)[source]
Compare an elf to another lib’s elf type, arch, and header metadata. Return True if they match, False otherwise.
- property needed
- property operating_system
- property rpath
- property runpath
- property soname
elfcall.main.graph.text module
elfcall.main.graph.cypher module
elfcall.main.graph.gexf module
elfcall.main.graph.dot module
elfcall.utils.terminal module
- elfcall.utils.terminal.confirm_action(question, force=False)[source]
confirm if the user wants to perform a certain action
- Parameters:
question (the question that will be asked) –
force (if the user wants to skip the prompt) –
- elfcall.utils.terminal.get_installdir()[source]
get_installdir returns the installation directory of the application
- elfcall.utils.terminal.iter_splitpath(path)[source]
Given a path (e.g., LD_LIBRARY_PATH or DT_RPATH or DT_RUNPATH split into individual paths
- elfcall.utils.terminal.run_command(cmd, sudo=False, stream=False)[source]
run_command uses subprocess to send a command to the terminal.
- Parameters:
cmd (the command to send, should be a list for subprocess) –
error_message (the error message to give to user if fails,) –
failed. (if none specified, will alert that command) –
elfcall.utils.fileio module
- elfcall.utils.fileio.copyfile(source, destination, force=True)[source]
Copy a file from a source to its destination.
- elfcall.utils.fileio.get_file_hash(image_path, algorithm='sha256')[source]
Return an sha256 hash of the file based on a criteria level.
- elfcall.utils.fileio.get_tmpdir(tmpdir=None, prefix='', create=True)[source]
Get a temporary directory for an operation.
- elfcall.utils.fileio.get_tmpfile(tmpdir=None, prefix='', suffix=None)[source]
Get a temporary file with an optional prefix.
- elfcall.utils.fileio.mkdir_p(path)[source]
mkdir_p attempts to get the same functionality as mkdir -p :param path: the path to create.