-
Notifications
You must be signed in to change notification settings - Fork 166
YARA Rules Management
BlackSnufkin edited this page Sep 6, 2025
·
4 revisions
LitterBox runs YARA in two analysis modes using the same rules file.
Both static and dynamic analysis use the same YARA rules:
static.yara:
rules_path: ".\\Scanners\\Yara\\LitterBox.yar"
command: "{tool_path} -s -m {rules_path} {file_path}"
dynamic.yara:
rules_path: ".\\Scanners\\Yara\\LitterBox.yar"
command: "{tool_path} -s -m {rules_path} {pid}"Main File: .\Scanners\Yara\LitterBox.yar
LitterBox.yar is a master include file that references all individual rule files in the Rules subdirectory:
include ".\rules\Linux_Backdoor_Bash.yar"
include ".\rules\Windows_Trojan_Cobalt.yar"
include ".\rules\Technique_ProcessHollowing.yar"
include ".\rules\Tool_Mimikatz.yar"
// ... more includesScanners/Yara/
βββ yara64.exe
βββ LitterBox.yar # Master include file
βββ Rules/ # Individual rule files
βββ Linux_Backdoor_Bash.yar
βββ Windows_Trojan_Cobalt.yar
βββ Technique_ProcessHollowing.yar
βββ Tool_Mimikatz.yar
βββ ... (other .yar files)
- Create new
.yarfile inRules/directory - Add include statement to
LitterBox.yar:
include ".\Rules\YourNewRules.yar"Edit any existing .yar file in the Rules/ directory
Generate Master Rules File - PowerShell script to automatically create include statements:
param (
[string]$RulesDirectory, # Path to the directory containing .yar files
[string]$OutputFile = "master_rules.yar" # Name of the master rules file
)
# Check if the specified directory exists
if (-Not (Test-Path -Path $RulesDirectory -PathType Container)) {
Write-Error "The specified directory does not exist: $RulesDirectory"
exit 1
}
# Get all .yar files in the directory
$yarFiles = Get-ChildItem -Path $RulesDirectory -Filter "*.yar"
if ($yarFiles.Count -eq 0) {
Write-Error "No .yar files found in the directory: $RulesDirectory"
exit 1
}
# Write include statements to the master rules file
try {
$outputPath = Join-Path -Path $RulesDirectory -ChildPath $OutputFile
# Clear the output file if it exists
if (Test-Path $outputPath) {
Remove-Item -Path $outputPath -Force
}
# Write include statements for each .yar file
foreach ($file in $yarFiles) {
$relativePath = $file.Name
Add-Content -Path $outputPath -Value "include `"$relativePath`""
}
Write-Host "Master rules file generated successfully at: $outputPath"
} catch {
Write-Error "An error occurred while generating the master rules file: $_"
}Usage:
.\generate_rules.ps1 -RulesDirectory ".\Scanners\Yara\Rules" -OutputFile "LitterBox.yar"- Scans uploaded files
- Uses
{file_path}placeholder - Command:
yara64.exe -s -m LitterBox.yar sample.exe
- Scans process memory
- Uses
{pid}placeholder - Command:
yara64.exe -s -m LitterBox.yar 1234
-
-s- Print string matches -
-m- Print metadata
- π Home
- π§ Application Architecture
- π Dashboard
- π All in One Pipeline
- π― Detection Score Explained
- 𧬠Blender Scanner
- π FuzzyHash Scanner
- π‘οΈ HolyGrail BYOVD Scanner
- π YARA Rules Management