A tool to check if your program does not include unwanted functions.
This program allows you to detect specific functions in a program, based on specific rules. You can choose for each function (using regular expressions), if you want to ban them or allow them. By default, every function is allowed.
curl -B https://raw.githubusercontent.com/Charlito33/rCheck2/refs/heads/master/install.sh | bash
- Very configurable.
- Full RegEx support.
- Program in entirely based on the
nm
command. - Library detection is based on
symbol@version
output, with version being detected as the library.
rcheck [target path] [configuration path]
Configuration should be stored in a .rcheck
directory and the configuration file should be named ruleset.json
.
The program does not support JSON with comments, this is only for demonstration purposes.
{
"config": {
"executables": [
"a.out"
]
},
"rules": [
{
"library": "GLIBC.*",
"ban": [
"printf"
]
}
]
}
{
"config": {
"executables": [
"a.out"
]
},
"rules": [
{
// CSFML is not detected in a library.
"ban": [
"sf.*_.*"
]
}
]
}
{
"config": {
"executables": [
"a.out"
]
},
"rules": [
{
// If you don't specify "library", the program will only ban functions that are not in a library.
"ban": [
"main"
]
}
]
}
{
"config": {
"executables": [
"a.out"
]
},
"rules": [
{
"library": ".*", // Apply to any library
"ban": [
".*" // Ban every function
]
}
]
}
(This will also ban GCC auto-generated functions).
{
"config": {
"executables": [
"a.out"
]
},
"rules": [
{
"library": ".*", // Apply to any library
"ban": [
".*" // Ban every function
]
},
{
"allow": [
"main" // Only allow main that is not in a library
]
}
]
}
You may want to remove the ^
and $
added to your RegEx expressions.
To do that, you just need to update the configuration.
{
"config": {
"extended_regex": true // Remove the '^' prefix and '$' suffix.
},
// ...
}
rCheck2 by Charles Mahoudeau is licensed under CC BY-NC-SA 4.0