cwrappers is a Python CLI toolkit for finding wrapper-like C/C++ functions (libc/syscall oriented) and optionally ranking them with fuzzy matching.
It is designed around compile_commands.json and Clang AST parsing.
Editable install:
python3 -m pip install -e .This exposes three console scripts:
cwrapperscwrappers-findercwrappers-fuzzy
Finder only:
cwrappers-finder \
--compile-commands /path/to/compile_commands.json \
--out wrappers.csvFuzzy scoring only:
cwrappers-fuzzy wrappers.csvCombined pipeline:
cwrappers pipeline \
--compile-commands /path/to/compile_commands.json \
--out wrappers.csv \
--fuzzyCallgraph-only export:
cwrappers-finder \
--compile-commands /path/to/compile_commands.json \
--callgraph-only \
--callgraph-out /path/to/callgraph_outSingle-function raw edge evidence export:
cwrappers-finder \
--compile-commands /path/to/compile_commands.json \
--edge-evidence target_function \
--out target_function_edges.csv--callgraph-only writes:
callgraph_edges.csv: raw edge rows, includingcaller_in_project/callee_in_projectcall_counts.csv: project-only per-callee incoming aggregates for project-defined calleesfunction_fan_summary.csv: project-only per-functionfan_in/fan_outsummary, while still reflecting external callers/callees on those project rowstranslation_units.csv: per-translation-unit parse diagnostics and exported-edge counts
cwrappers ships with a bundled default catalog at cwrappers/data/categorized_methods.yaml.
cwrappers-finderuses it automatically when--yamlis not provided.cwrappers-fuzzyuses it automatically when--yamlis not provided.- You can always override with
--yaml /path/to/custom.yaml.
Unified CLI:
cwrappers --help
cwrappers finder --help
cwrappers fuzzy --help
cwrappers pipeline --helpDirect subtool CLIs:
cwrappers-finder --help
cwrappers-fuzzy --help- Python 3.9+
- Clang/libclang available in your environment
- A valid
compile_commands.json(for finder/pipeline)
This repository uses a flat layout for packaging:
pyproject.toml
README.md
cwrappers/
__init__.py
cli.py
data/
finder/
fuzzy/
shared/
MIT