graudit is a free, open source threat detection & response project written in Shell and released under GPL-3.0. It has 1,689 GitHub stars, 258 forks and 0 open issues, and was last pushed 9 months ago. On this registry it ranks #34 of 42 tracked projects in Threat Detection & Response, with 5 head-to-head comparisons available.

What is graudit?

graudit is a shell script and set of grep-based signature databases that finds potential security flaws in source code, aimed at developers, auditors and security testers who want static analysis while keeping technical requirements to a minimum.

What it is

graudit (short for grep rough audit) is a source code auditing tool written in Shell and released under the GPL-3.0 licence. It runs the GNU grep utility over a codebase using signature sets written as extended regular expressions (POSIX), and it ships with ready-made databases covering many languages and problem classes. It lives in the security and vulnerability-detection ecosystem, tagged security-audit, security-tools and source-code, and it is comparable to static analysis applications such as RATS, SWAAT and flaw-finder.

The problem it solves is the cost of a first pass over unfamiliar or third-party source: instead of installing a heavier analysis application, an auditor runs graudit [opts] /path/to/scan and starts reading matches. It keeps technical requirements to a minimum and stays flexible, but it is a screening aid rather than a verdict, and every hit is a candidate flaw for a human to triage.

Key capabilities

  • Bundles databases for actionscript, android, asp, c, cobol, dotnet, eiffel, go, ios, java, js, nim, perl, php, python, ruby, scala, typescript and xss, plus a default database used when -d is omitted.
  • Selects a database with -d, taking a named database or a full path to a .db file, and lists them with -l.
  • Writes every rule as an extended regular expression (POSIX), so databases can be extended or authored from scratch, and rules can be read from stdin via - or /dev/stdin.
  • Resolves databases by a fixed order of precedence, starting with GRDIR and continuing through /usr/share/graudit/, $HOME/.graudit/ and a relative signatures/ directory.
  • Tunes output with -c (context lines, default 1), -B (suppress banner), -L (vim-friendly lines), -b (colour-blind friendly template), -z (no colours) and -Z (high contrast).
  • Filters scope with -x for comma-separated exclusions such as -x *.js,*.sql, -A to scan unwanted and difficult (ALL) files, and -i for case-insensitive scans.
  • Honours GRARGS for default command-line options and reports help and version with -h and -v.

Who uses it and how

  • Security auditors and penetration testers run it as a fast first pass over an unfamiliar codebase, then triage the matches by hand.
  • Developers clone the repository, add it to PATH in ~/.bashrc and set GRDIR to the signatures directory so it is always available for ad-hoc checks.
  • Teams call it from scripts and build steps; the README cautions that GRARGS can affect scripting use and recommends limiting it to the B, L, b, z and Z options for that purpose.
  • Contributors extend coverage, since language rules, additional scripts and documentation are welcome through a fork of the repository.
  • It fits constrained environments, where a shell and GNU grep are the only real runtime requirements.

Getting started

Install with make userinstall or make install as a user or as root, but the README recommends cloning https://github.com/wireghoul/graudit instead, because the repository includes additional database rules not present in the distribution files and allows updates between releases. The clone is then added to PATH, with GRDIR set if it does not live in the home directory.

How it compares

graudit places itself alongside RATS, SWAAT and flaw-finder as a static analysis option, but takes a lighter route by keeping technical requirements to a minimum and remaining flexible. The trade is depth for portability: signature matching over raw source is easy to run and easy to extend, while those heavier applications aim at more structured analysis.

When to use it — and when not to

Adopting graudit means operating almost nothing beyond a shell, GNU grep and optionally a cloned signatures directory, but its output is a rough list of regular expression matches, so anyone who needs parsed, data-flow-aware results with few false positives should look elsewhere, and every hit must be triaged by hand. Self-hosters who want the fullest rule set should clone the repository rather than install from distribution files, which omit some databases. The README is brief and the project describes itself as a rough audit, so treat it as a screening step ahead of manual review rather than a source of confirmed findings.

project readme (upstream, from github) — read inline

graudit

graudit is a simple script and signature sets that allows you to find potential security flaws in source code using the GNU utility grep. It's comparable to other static analysis applications like RATS, SWAAT and flaw-finder while keeping the technical requirements to a minimum and being very flexible.

Installation

Installation can be done as a user or globally as root, simply run make with the userinstall or install argument. It is however recommended to use graudit directly by cloning the git repository as it includes additional database rules not included on the distribution files. This also enables you to get updates between releases. To do this run the following command:

git clone https://github.com/wireghoul/graudit

You can then add graudit to your path, using the appropriate values for your preferred shell:

echo 'PATH="$HOME/graudit:${PATH:+:${PATH}}"; export PATH;' >> ~/.bashrc

If graudit is not in your home directory you may wish to set the GRDIR environment variable to the signatures directory in your .bashrc file.

export GRDIR=/path/to/graudit/signatures

Usage

graudit supports several options and tries to follow good shell practices. For a list of the options you can run graudit -h or see below. The simplest way to use graudit is;

graudit [opts] /path/to/scan

OPTIONS
  -d <dbname> database to use or /path/to/file.db (uses default if not specified)
  -A scan unwanted and difficult (ALL) files
  -x exclude these files (comma separated list: -x *.js,*.sql)
  -i case in-sensitive scan
  -c <num> number of lines of context to display before and after a match, default is 1

  -B suppress banner
  -L vim friendly lines
  -b colour blind friendly template
  -z suppress colors
  -Z high contrast colors
  
  -l lists databases available
  -v prints version number
  -h prints this help screen

You can set default commandline options via the GRARGS environment variable. This may affect the use of graudit in scripts so it's only recommended to use the B,L,b,z and Z options for this purpose.

echo 'GRARGS="-b -L"; export GRARGS' >> ~/.bashrc

Databases

graudit uses extended regular expressions (POSIX) as it's signatures and comes with several databases ready for use. You can extend the existing databases or make your own if you require additional signatures.

Databases can be loaded from multiple locations, the order of precedence is as follows:

  1. Custom location specified via the GRDIR environment variable
  2. /usr/share/graudit/
  3. $HOME/.graudit/
  4. A relative signatures/ directory from the graudit location
  5. A relative misc/ directory from the graudit location
  6. $HOME/graudit/signatures/
  7. Any file that is specified with a full path, i.e: /home/user/my.db
  8. Rules can be read from stdin by supplying - or /dev/stdin as the database

A list of the database files in order of precedence is shown with the -l switch: graudit -l

The following databases are included:

  • actionscript
  • android
  • asp
  • c
  • cobol
  • default (used if -d argument is omitted)
  • dotnet
  • eiffel
  • exec
  • fruit
  • go
  • ios
  • java
  • js
  • nim
  • perl
  • php
  • python
  • ruby
  • scala
  • secrets
  • spsqli
  • sql
  • strings
  • typescript
  • xss

Tutorial

A tutorial/introduction video can be found at: https://youtu.be/b8Xbzer1n94

Contributing

If you would like to contribute to graudit, please fork the repository at https://github.com/wireghoul/graudit and use that. In particular language rules, additional scripts and documentation contributions are very welcome. If you like graudit then please say thanks and share it around.

If you wish to get in contact with me, shoot me a line on github or twitter: @wireghoul

Credits

Frequently asked questions

Is graudit free to use?

graudit is open source under the GPL-3.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does graudit do?

grep rough audit - source code auditing tool

What is graudit written in?

graudit is primarily written in Shell. Its source is publicly available at https://github.com/wireghoul/graudit, and it has 1,689 GitHub stars.