go-yara compiles YARA rules and scans byte slices, readers, and files in Go. It runs without CGO or an installed copy of libyara, so you can include the engine in a Go service or build a standalone scanner.
Quickstart · Browser playground · Installation
Library
Section titled “Library”Compile a rule set once and reuse the program across scans. Host modules expose application data to rules alongside the input bytes.
The engine supports text strings, hex patterns, regular expressions, and the built-in hash, math, string, time, and pure-Go pe modules (pe added in v0.10.0; see PE module coverage). It also provides structured host modules and optional evidence extraction for credential-scanning workflows.
Compatibility
Section titled “Compatibility”Native elf, cuckoo, and dotnet modules are not bundled, and go-yara has extensions that libyara does not accept. The compatibility guide identifies those boundaries. Test your rule corpus and expected matches before replacing another engine.
ScanReader uses a bounded sliding input window, while retained occurrences and result data can grow with matches. Block scanning retains supplied blocks. See input APIs for memory use and condition evaluation.
Documentation
Section titled “Documentation”| Topic | Guide |
|---|---|
| Dependencies and binaries | Installation |
| Rule compilation and diagnostics | Quickstart |
| Input APIs, sparse blocks, and scanner lifetime | Scanning |
| Credential extraction and validation | Evidence examples |
| Built-in functions and host data | Modules |
| Scan costs and benchmarks | Performance |
| Commands and options | CLI reference |
| Versions and compiled rule caches | Releases and upgrades |
For exported types and methods, use the Go API reference. Source code, issue reports, and release artifacts are in the GitHub repository.