ForbCheck is a Bash CLI tool designed to analyze a compiled C executable or library and detect the usage of forbidden functions, closely matching how projects are evaluated at 42.
It relies on nm to inspect unresolved symbols and reports exact source locations where forbidden functions are used.
- Deep Analysis: Uses
nmand object file scanning (.o) to distinguish between undefined symbols and your own internal functions. No more false positives from your own utils. - Smart Context Awareness: Automatically detects external libraries like MiniLibX (
-mlx) or Math (-lm) to avoid flagging allowed external calls. - Blazing Fast: Optimized parallel scanning (
xargs -P4). Runs in under 0.2s on most projects. - Stale Binary Detection: Smartly compares source code timestamps with your binary. If you forgot to
make re, ForbCheck warns you that results might be outdated. - Precision Locator: Pinpoints exactly where the forbidden function is called (file and line number).
- Comment Ignoring: ForbCheck is now smart enough to ignore forbidden keywords found in comments (e.g.,
// TODO: remove printf). It only flags code that actually compiles!
- Desync Warning: Modified your
.cfiles but forgot to recompile? The tool now alerts you immediately to prevent testing against an old binary. - Undo-Friendly: The intelligent cache tracks line counts and file sizes. If you undo changes (Ctrl+Z), the warning resolves itself automatically.
- Hybrid List Command: Use
-lto view all authorized functions, orforb -l <func>to quickly check the status of a specific one. - Global Awareness: Seamlessly switch between projects (e.g.,
minishell->cub3d). The tool updates its internal reference context instantly. - Cleaner Help: A reorganized
--helpmenu for better readability during those late-night coding sessions.
- Optimized: Even on standard school lab machines, the overhead remains negligible, ensuring your workflow is never interrupted.
bashnm(GNU binutils)grep,awk,sedbc(optional, for execution time display)
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Mrdolls/forb/refs/heads/main/install.sh)"forb [options] <target> [-f <files...>]<target>: Executable or library to analyze
| Option | Description |
|---|---|
-h, --help |
Display help message |
-l, --list [<funcs...>] |
Show list or check specific functions |
-e, --edit |
Edit authorized functions list |
| Option | Description |
|---|---|
-v, --verbose |
Show source code context |
-f <files...> |
Limit analysis to specific files |
-p, --full-path |
Show full paths |
-a, --all |
Show authorized functions during scan |
--no-auto |
Disable automatic library detection |
| Option | Description |
|---|---|
-mlx |
Force ignore MiniLibX internal calls |
-lm |
Force Ignore Math library internal calls |
| Option | Description |
|---|---|
-t, --time |
Show execution duration |
-up, --update |
Update ForbCheck |
--remove |
Uninstall ForbCheck |
forb minishell (no forbidden fonctions)
forb -t minishell (with forbidden fonctions)
forb minishell -f heredoc_utils.c
forb -v minishell
Authorized functions are defined in:
$HOME/.forb/authorize.txt
Functions may be separated by new lines, spaces, or commas.
Quick edit:
forb -eExample:
read
write
malloc
free
or
read, write, malloc, free
| Code | Meaning |
|---|---|
0 |
No forbidden functions detected |
1 |
Forbidden functions detected or error occurred |
ForbCheck is designed to be:
- Simple
- Readable
- Useful before project evaluations
- Explicit rather than permissive
It is an assistance tool, not a substitute for understanding project requirements.
Open-source project intended for educational use.
Mrdolls