The FindSecrets is a command-line tool written in Go that scans files in a given directory for specified patterns such as email addresses, IP addresses, URLs, and various tokens and keys. It supports outputting the results in HTML, JSON, and plain text formats.
To set up the FindSecrets, you need to have Go installed on your machine. Follow these steps:
- Clone the repository to your local machine.
- Navigate to the cloned directory.
- Build the program using
go build.
Run the program with the following command-line arguments:
-d: Specify the directory path to scan.-o: Specify the output format (html,json, ortxt).
Example:
go run main.go -d /path/to/directory -o json./findsecrets -d /path/to/directory -o jsonThis will scan the directory /path/to/directory and output the results in JSON format.
The tool generates an output file in the chosen format with the detected patterns. The output includes the pattern's label, the file path where it was found, and the line number.
- HTML output: Provides a list of hyperlinks for each match found, allowing easy navigation to the matched line in the file.
- JSON output: Useful for further processing with other tools or importing into databases.
- TXT output: A simple text file with one match per line.
Contributions to the FindSecrets are welcome. Please fork the repository, make your changes, and submit a pull request.