-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.ps1
22 lines (17 loc) · 930 Bytes
/
compile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Set the path to your YARA directory
$YaraDir = "C:\Users\HarrisonEdwards\Downloads\yara_rules-main\yara_rules-main"
# Set the output compiled rules file
$OutputRules = "C:\Users\HarrisonEdwards\Downloads\yara_rules-main\yara_rules-main\Compiled.yar"
# Get all .yar files in the directory
$YaraFiles = Get-ChildItem -Path $YaraDir -Filter *.yar -Recurse
# Construct the file paths for yarac command
$YaraFilesPaths = $YaraFiles.FullName -join " "
# Compile the YARA files into a compiled ruleset
$YaracPath = "C:\Users\HarrisonEdwards\Downloads\yara-v4.5.2-2326-win64\yarac64.exe" # Modify this to point to your yarac executable
$Command = "$YaracPath $YaraFilesPaths $OutputRules"
Invoke-Expression $Command
if ($LASTEXITCODE -eq 0) {
Write-Output "Compilation successful! Compiled ruleset saved to $OutputRules"
} else {
Write-Output "Compilation failed. Check the YARA files for issues."
}