YaraXSharp 1.0.3.170
dotnet add package YaraXSharp --version 1.0.3.170
NuGet\Install-Package YaraXSharp -Version 1.0.3.170
<PackageReference Include="YaraXSharp" Version="1.0.3.170" />
<PackageVersion Include="YaraXSharp" Version="1.0.3.170" />
<PackageReference Include="YaraXSharp" />
paket add YaraXSharp --version 1.0.3.170
#r "nuget: YaraXSharp, 1.0.3.170"
#:package YaraXSharp@1.0.3.170
#addin nuget:?package=YaraXSharp&version=1.0.3.170
#tool nuget:?package=YaraXSharp&version=1.0.3.170
Yara-X Sharp
A simple wrapper for Yara-X around the Yara-X C/C++ API.
You can find the Nuget package here.
Requirements
As of 1.0.2, Windows x86_64
and Linux x86_64
version of Yara X CAPI is included in the Nuget package.
If you are on Apple silicon or want to bring your own yara_x_capi.dll
, you can follow the compile guide here.
Usage
/*
* New Compiler instance.
* You can pass multiple params from YRX_COMPILE_FLAGS.
* E.g. new Compiler(YRX_COMPILE_FLAGS.YRX_ERROR_ON_SLOW_PATTERN)
*/
var yara = new Compiler();
yara.AddRuleFile("./eicar.yar");
var (rules, errors, warnings) = yara.Build(); // Compiled rules to be used in Scanner.
Scanner scanner = new Scanner(rules, YRX_SCANNER_FLAGS.LOAD_METADATA, YRX_SCANNER_FLAGS.LOAD_PATTERNS);
scanner.scan("./eicar.txt");
List<Match> results = scanner.Results();
foreach (Match rule in results) {
Console.WriteLine($"Pattern match count: {rule.Patterns.Count}");
Console.WriteLine(rule.Metadata["malware_family"]);
}
// Make sure to destroy.
scanner.Destroy();
yara.Destroy();
Or
using (var yara = new Compiler())
{
yara.AddRuleFile(Path.Combine(Environment.CurrentDirectory, "../../../", "eicar.yar"));
yara.AddRuleFile(Path.Combine(Environment.CurrentDirectory, "../../../", "eitwo.yar"));
var (rules, errors, warnings) = yara.Build();
Console.WriteLine($"Number of rules: {rules.Count()}");
using (Scanner scanner = new Scanner(rules, YRX_SCANNER_FLAGS.LOAD_METADATA, YRX_SCANNER_FLAGS.LOAD_PATTERNS))
{
scanner.Scan(Path.Combine(Environment.CurrentDirectory, "eicar.txt"));
List<Match> results = scanner.Results();
Console.WriteLine($"Matches: {results.Count}");
foreach (Match rule in results)
{
Console.WriteLine($"Pattern match count: {rule.Patterns.Count}");
Console.WriteLine(rule.Metadata["malware_family"]);
}
}
}
Reference
Compatibility
Any suffix after the initial x.x.x
for example 1.0.3.160
signifies that it is compatible with the associated Yara-X version (in this case v1.6.0) as well as the CAPI being bundled in Nuget.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.3.170 | 236 | 9/17/2025 |
1.0.3.160 | 119 | 9/5/2025 |
1.0.3 | 136 | 8/20/2025 |
1.0.2 | 141 | 8/13/2025 |
1.0.2-rc.2 | 176 | 8/8/2025 |
1.0.2-rc | 190 | 8/8/2025 |
1.0.1 | 83 | 8/1/2025 |
1.0.0 | 116 | 7/31/2025 |
0.1.0 | 525 | 7/22/2025 |
0.0.5 | 137 | 7/16/2025 |
0.0.4 | 139 | 7/14/2025 |
0.0.3 | 140 | 7/13/2025 |
0.0.2 | 102 | 7/13/2025 |
0.0.1 | 68 | 7/12/2025 |