{"id":27066083,"url":"https://github.com/maxrt101/elfview","last_synced_at":"2025-04-05T18:34:58.063Z","repository":{"id":284139208,"uuid":"921125130","full_name":"maxrt101/elfview","owner":"maxrt101","description":"TUI Script to inspect ELF contents","archived":false,"fork":false,"pushed_at":"2025-03-24T10:39:49.000Z","size":4926,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T11:36:40.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxrt101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-23T11:37:36.000Z","updated_at":"2025-03-24T10:39:52.000Z","dependencies_parsed_at":"2025-03-24T11:47:27.662Z","dependency_job_id":null,"html_url":"https://github.com/maxrt101/elfview","commit_stats":null,"previous_names":["maxrt101/elfview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Felfview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Felfview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Felfview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Felfview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxrt101","download_url":"https://codeload.github.com/maxrt101/elfview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247384987,"owners_count":20930567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-05T18:34:57.486Z","updated_at":"2025-04-05T18:34:57.718Z","avatar_url":"https://github.com/maxrt101.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n /$$$$$$$$ /$$       /$$$$$$$$ /$$    /$$ /$$                        \n| $$_____/| $$      | $$_____/| $$   | $$|__/                        \n| $$      | $$      | $$      | $$   | $$ /$$  /$$$$$$  /$$  /$$  /$$\n| $$$$$   | $$      | $$$$$   |  $$ / $$/| $$ /$$__  $$| $$ | $$ | $$\n| $$__/   | $$      | $$__/    \\  $$ $$/ | $$| $$$$$$$$| $$ | $$ | $$\n| $$      | $$      | $$        \\  $$$/  | $$| $$_____/| $$ | $$ | $$\n| $$$$$$$$| $$$$$$$$| $$         \\  $/   | $$|  $$$$$$$|  $$$$$/$$$$/\n|________/|________/|__/          \\_/    |__/ \\_______/ \\_____/\\___/    \n```\n\n## ELFView\n\nScript to inspect ELF files.  \nUses pyelftools or lief (can be configured) to extract various information from ELF file.  \nCurrently extracts:  \n - Name  \n - Size  \n - Created/Modified/Accessed dates  \n - ELF File type  \n - Target Machine  \n - ABI  \n - Flags  \n - Entrypoint  \n - Sections (type, offset, size, flags, alignment)  \n - Hexdump of each sections' contents  \n - All source files that were used in compilation and their (compiled) sizes [1]  \n - All functions (code size, name, return type, argument names and types) [1]  \n - All variables (code size, name, type) [1]  \n - Cumulative size of functions and variable for whole ELF file [2] and for CU (source file) [1]  \n - All symbols (from `.symtab` section)  \n - All strings (either from string sections, or from whole file (scanned))  \n - Hexdump of whole ELF file  \n\n[1] - Needs Dwarf sections present (can be enabled using debug a build).  \n[2] - Use `f` key in Files window to filter files by part of name or folder.  \n\n### Usage\nRun elfview with desired ELF file: `python3 elfview.py Test.elf`.  \n\n![General Info Window](img/general_info.png)\n\n### Keybinds\nUse `q` to exit.\nUse `Tab` to switch between windows (topmost bar indicates which windows are available and which is currently selected)  \nUse `LEFT ARROW`/`RIGHT ARROW` to switch between sub windows (pads).  \nUse `UP ARRAY`/`DOWN ARROW` to scroll in lists.  \nUse `/` to trigger search dialogue where it is applicable.  \nUse `f` in `Files` pad of `Files/Functions` window to trigger filter dialogue.  \nUse `[`/`]` to skip `config.PAGE_SCROLL_SKIP_SIZE` lines at once.  \nUse `ESC` to close dialogues (search/filter and such).  \nUse `n`/`p` to select next/prev occurrence of searched text.  \n\n### Search/Filter\nPress `f`, enter phrase to search for and press `Enter`.  \n\n![Section Search Dialogue](img/sections_search_window.png)\n\nIt should work in any window with scrollable content.  \n\nUpon successful search cursor will be moved to first occurrence of searched string.  \nAll occurrences will be highlighted.  \n\n![Successful Section Search](img/sections_search_success.png)\n\nIf search didn't find anything, you will see an alert.  \nIt can be closed by pressing any key.  \n\n![Failed Section Search](img/sections_search_failure.png)\n\nFilter works the same way, but without alerts, if nothing's found and is usable only in `Files/Functions` window.  \n\n### Installation\nClone the repo: `git@github.com:maxrt101/elfview.git`.  \nInstall pyelftools (recommended) or LIEF extended.  \nCreate virtual environment and activate it (or not): `python3 -m venv .venv \u0026\u0026 . .venv/bin/activate`.  \nInstall elfview: `pip3 install .` (use `pip3 install -e .` for development).  \nRun the script, either directly `python3 elfview.py \u003cELF\u003e` or through script install in env `bin` (e.g. if using venv: `./.venv/vin/elfview \u003cELF\u003e`).  \n\n### Command Line Arguments\n```commandline\nusage: ELFView [-h] [-b BACKEND] [-r REMOVE_FILE_PREFIXES] [-c CONFIG_OVERRIDES] FILE\n\nTUI Application to look into ELF files\n\npositional arguments:\n  FILE                                            ELF file to parse\n\noptions:\n  -h, --help                                      show this help message and exit\n  -b BACKEND, --backend BACKEND                   What library to use as backend (elftools or lief)\n  -r REMOVE_FILE_PREFIXES, --remove-file-prefix REMOVE_FILE_PREFIXES\n                                                  Removes specified file prefix from Files window (to see the actual file name)\n  -c CONFIG_OVERRIDES, --config CONFIG_OVERRIDES  Override config variables at runtime. Example -c DEBUG=True\n```\n\n`FILE` - Path to ELF File.  \n`-h, --help` - Prints above message.  \n`-b, --backend` - Specifies backend library to use (`elftools` or `lief`).  \n`-r, --remove-file-prefix` - Prefix for `Files` tab in `Files/Functions` window to be removed from CU path.  \n`-c, --config` - Override config value.  \n\n\n### Config\nA lot of things can be configured through value present in `elfvview/config.py` file.  \nYou can configure your own installation (e.g. remap keys, change colors) by editing this file and reinstalling the package.  \nAnother possibility to reconfigure functionality on-the-fly is to use `-c, --config` (e.g. `-c DEBUG=True`).  \n\nHere is a brief description of all configurable options:  \n`BACKEND` - Select default backend (`elftools`/`lief`).  \n`USE_COLORFUL_HEXDUMP` - Use color accents on every hexdump generated.  \n`DEFER_HEXDUMP_GENERATION` - Don't generate whole hexdump upon file parsing.  \n`RESET_FINDER_ON_LINKED_PAD_CHANGE` - Reset search when parent tab changed position (e.g. when selected file is changed, reset search in function pad).  \n`SEARCH_WHOLE_BUFFER` - Affects all search. If on - will not search all buffer, only area around cursor, specified by `SEARCH_REACH`.  \n`SEARCH_REACH` - Offsets (positive and negative) for cursor then `SEARCH_WHOLE_BUFFER` if off.  \n`SEARCH_USE_NEXT_OCCURRENCE` - Turns on/off functionality of `n`/`p`. By default, mirrors `SEARCH_WHOLE_BUFFER` because selecting occurrences on partial search is unstable.  \n`DEBUG` - Turns on some debug features (e.g. will print window and pad number in left corner, and print startup logs one line at a time, waiting for a keypress).  \n`USE_STRINGS_FROM_SECTIONS` - Don't parse whole ELF for strings, use ones available in `.symtab` and such.  \n`DEFAULT_STRING_MIN_LENGTH` - If `USE_STRINGS_FROM_SECTIONS` is `False`, will use this length as a minimal criteria for considering a null-terminated sequence of characters a string.  \n`PAGE_SCROLL_SKIP_SIZE` - How many lines should `[`/`]` skip.  \n`WINDOW_SWITCH_BAR_SIZE` - Height of window switch bar (topmost bar with currently selected window amongst list of all windows)  \n`FILES_WINDOW_INFO_PAD_SIZE` - Height of `Info` pad under `Files/Variables` window.  \n`HEXDUMP_WIDTH_TO_BYTE_SIZE_COEFFICIENT` - Magic number that is used to calculate number of bytes in line for hexdump considering screen width.  \n\n`KeyMap` - Key mapping, name should suggest what the binding is responsible for, value shows default value. Uses int value of ascii char as value.  \n`ColorMap` - Color mapping. First value in tuple is foreground color, second - background.  \n\nThere is currently no way to redefine keys or colors from command line, so reinstallation is required.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Felfview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxrt101%2Felfview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Felfview/lists"}