Pattern matching swiss knife for malware researchers to identify and classify malware samples based on textual or binary patterns.
yara {flags} {rule-file} {target} ๐ flags ๐ rule-file ๐ target yara {flags} {rule-file} {target} Sandbox: execFile · Timeout: 300s
malware.analyze malware.classify malware.detect forensics.scan binary.pattern.match | Name | Type | Required | Default | Description | Aliases |
|---|---|---|---|---|---|
rule-file | string | Yes | - | YARA rule file or directory | - |
target | string | Yes | - | File, directory, or PID to scan | - |
flag-s | boolean | No | - | Print strings that matched | -s, --print-strings |
flag-m | boolean | No | - | Print meta data | -m, --print-meta |
flag-n | boolean | No | - | Print only rule names | -n, --negate |
flag-g | integer | No | - | Number of tags to print | -g, --tag |
flag-r | boolean | No | - | Recursive directory scan | -r, --recursive |
flag-c | boolean | No | - | Print count of matches | -c, --count |
flag-p | integer | No | - | Number of parallel threads | -p, --threads |
| Type | Description | MIME | Schema | Trust |
|---|---|---|---|---|
report.txt | YARA scan results | text/plain | - | verified |
report.json | YARA scan results in JSON | application/json | - | verified |
Inputs
file.path File or directory to scan
security.rule.file YARA rule file to apply
Outputs
report.txt Scan results with matched rules
report.json Scan results in JSON format
filesystem_write Produces
report.txtreport.jsonConsumes
file.pathsecurity.rule.file| Resource | Value |
|---|---|
| CPU | medium |
| Memory | 256 MB |
| Network | none |
| Disk I/O | medium |
Scan a file with a YARA rule
yara rule.yara suspicious.exe Scan a directory recursively
yara -r malware_rules/ /samples/ Print matched strings
yara -s myrule.yar sample.bin Scan with multiple rule files
yara -r rules/ -c sample.exe Scan a running process by PID
yara rule.yara <PID> YARA is a pattern matching tool designed for malware researchers to create descriptions of malware families based on textual or binary patterns. Rules consist of strings definitions and boolean expressions that determine the logic.
rule ExampleRule {
meta:
description = "Example YARA rule"
author = "Researcher"
strings:
$text_string = "malicious_string"
$hex_string = { 4D 5A 90 00 }
$byte_string = "This program" nocase
condition:
$text_string or $hex_string
}
# Scan files with rules
yara -s rules.yara /path/to/malware.exe
# Recursive directory scan
yara -r /path/to/rules/ /samples/directory/
# Scan with metadata output
yara -m rules.yara suspicious.bin