Registry / viv-utils

viv-utils

JSON →
library0.8.1pypypi✓ verified 84d ago

viv-utils (version 0.8.1) is a Python library providing utilities for binary analysis, specifically designed to complement vivisect. It offers helper functions and abstractions for common tasks like extracting information from vivisect workspaces, navigating control flow graphs, and working with function metadata. Its release cadence is somewhat infrequent, driven by the needs of its primary developers and the broader vivisect ecosystem.

pip install viv-utils
INSTALL
IMPORT
SIG · VIV-UTILS
V
viv-utils
pythonv0.8.1
Install
5.3s avg
Import
Disk
70MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 68.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 5.3s · import 0.000s · 69MB
70MB installed
● package 70MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

API
from viv_utils import API
from viv_utils.api import from_vivisect

This quickstart demonstrates how to initialize `viv-utils` with a `vivisect` workspace (using a minimal mock for runnable example) and iterate through functions, accessing their basic properties. In a real scenario, `vw` would be a fully loaded and analyzed `vivisect.VivWorkspace` object.

import viv_utils.api as viv_api from unittest.mock import MagicMock # --- Start Minimal Mock for Demonstrative vivisect Workspace --- # In a real scenario, 'vw' would be an actual vivisect.VivWorkspace # loaded with a binary and analyzed (e.g., vw.loadFromFile("path/to/binary"); vw.analyze()). class MockVivWorkspace: def __init__(self): self.arch = "amd64" # Required by viv_utils self._functions = { 0x1000: {"name": "entry_point", "blocks_count": 3}, 0x1050: {"name": "utility_func", "blocks_count": 2}, } def getMetaInfo(self, key, default=None): # viv_utils queries meta info, e.g., 'Platform' return {"Platform": "windows"}.get(key, default) def getFunctions(self): return list(self._functions.keys()) def getFunction(self, va): if va not in self._functions: return None # viv_utils expects specific attributes on the function object func_data = self._functions[va] mock_func = MagicMock() mock_func.va = va mock_func.name = func_data["name"] mock_func.basic_blocks = [MagicMock() for _ in range(func_data["blocks_count"])] # Simulate basic blocks mock_func.getBasicBlocks.return_value = {0x1000: (0x10, 5)} # dummy for internal access if needed return mock_func def getComments(self, va): return None # Often queried def getCodeBlocks(self): return [] # Often queried def getVivTaint(self): return MagicMock() # For emulator, though not used in this quickstart vw = MockVivWorkspace() # --- End Minimal Mock --- # Wrap the mock vivisect workspace with viv-utils API utils_workspace = viv_api.from_vivisect(vw) print("Listing functions from the viv-utils wrapped workspace:") for func in utils_workspace.get_functions(): print(f" Function VA: {hex(func.va)}, Name: '{func.name}', Basic Blocks: {len(func.basic_blocks)}") # Example: Access a specific function by VA target_va = 0x1050 target_func = utils_workspace.get_function(target_va) if target_func: print(f"\nDetails for function '{target_func.name}' at {hex(target_func.va)}:") print(f" Number of basic blocks: {len(target_func.basic_blocks)}") else: print(f"\nFunction at {hex(target_va)} not found.")
Debug
Known issues
breakingStarting with `viv-utils` v0.8.0, the library explicitly requires `vivisect_v8>=1.0.0`. Older versions of `vivisect` (e.g., those installed directly from GitHub without the `_v8` suffix or prior to `vivisect_v8`'s release) are no longer compatible.
fix
Ensure you have `vivisect_v8` installed: `pip install vivisect-v8`. Uninstall any older vivisect installations if they cause conflicts.
affects: >=0.8.0
gotchaThe `viv_utils` API relies on a fully analyzed `vivisect.VivWorkspace` object. If the underlying workspace (`vw`) has not been properly loaded from a binary and `vw.analyze()` called, many `viv-utils` methods like `get_functions()` or `get_function()` might return empty results or raise `AttributeError` if attempting to access unpopulated fields.
fix
Always ensure your `vivisect.VivWorkspace` object has been loaded from a binary and fully analyzed before passing it to `viv_utils.api.from_vivisect()`.
affects: All
gotchaSome functionalities, especially related to emulation (`viv_utils.emulator.VivEmulator`), might expect specific methods or data structures to be present in the `vivisect.VivWorkspace` object or its internal components. Using a partially initialized or very old `vivisect` workspace can lead to `AttributeError`.
fix
Verify that your `vivisect_v8` installation is complete and compatible. If using `VivEmulator`, ensure your `vivisect` workspace has been sufficiently analyzed to populate necessary taint tracking or memory emulation structures.
affects: All
Upgrade
Version history
0.8.1latest on PyPI · released Oct 1, 2025
Audit
Dependencies
vivisect_v8requiredCore dependency for vivisect workspace interaction (pip installable since v0.8.0 of viv-utils)
mnemonistrequiredUsed for various data structures and memoization
tqdmrequiredProvides progress bars for long-running operations
Agent activity
2 hits · last 30 days
node
2
Resources
viv-utils — pip install viv-utils · libregistry