Skip to content

Latest commit

 

History

History
164 lines (133 loc) · 3.72 KB

README.md

File metadata and controls

164 lines (133 loc) · 3.72 KB

rCheck2

A tool to check if your program does not include unwanted functions.

Description

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.

Installation

curl -B https://raw.githubusercontent.com/Charlito33/rCheck2/refs/heads/master/install.sh | bash

Features

  • Very configurable.
  • Full RegEx support.

Limitations

  • Program in entirely based on the nm command.
  • Library detection is based on symbol@version output, with version being detected as the library.

Usage

Program arguments

rcheck [target path] [configuration path]

Configuration

Configuration should be stored in a .rcheck directory and the configuration file should be named ruleset.json.

Rules examples

The program does not support JSON with comments, this is only for demonstration purposes.

Ban printf

{
  "config": {
    "executables": [
      "a.out"
    ]
  },
  "rules": [
    {
      "library": "GLIBC.*",
      "ban": [
        "printf"
      ]
    }
  ]
}

Ban every CSFML functions

{
  "config": {
    "executables": [
      "a.out"
    ]
  },
  "rules": [
    {
      // CSFML is not detected in a library.
      "ban": [
        "sf.*_.*"
      ]
    }
  ]
}

Ban main function

{
  "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"
      ]
    }
  ]
}

Ban every functions

{
  "config": {
    "executables": [
      "a.out"
    ]
  },
  "rules": [
    {
      "library": ".*", // Apply to any library
      "ban": [
        ".*" // Ban every function
      ]
    }
  ]
}

Only allow main 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
      ]
    }
  ]
}

Use unmodified RegEx

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