Home

Awesome

yara_file_cheсker

the library is designed to make it easier to check potentially malicious files and archives using YARA and make a decision about their harmfulness based on the weights of the detected rules

Config:

Using:

var log = new SynchronousConsoleLog(); 
var fileChecker = new FileChecker();
var fileBytes = ReadFileBytes(sampleFilePath);
var fileObject = new FileObject(fileBytes, sampleFilePath); 
var scanMode = FileChecker.ScanMode.Mid; 
/*
rules from:
- Lite -  Resources/YaraRules/Lite
- Mid - Lite + Resources/YaraRules/Mid
- Hard - Mid + Resources/YaraRules/Hard
- Custom - Resources/YaraRules/custom. 
*/

var result = fileChecker.CheckFile(fileObject, scanMode, log); // FileScanResult со следующими свойствами%
/*
    ScanSuccessful - is scan successful (if not - check AdditionalInfo)
    YaraResults - list of ScanResult https://github.com/microsoft/libyara.NET/blob/master/libyara.NET/ScanResult.h
    AdditionalInfo
    FileName - file name/ filenames delimited with | in case of checking archives
    MatchedRules - list of matched rules names
    Executable - is executable/ archive contains one or more executables
    TotalScore - summ of yara rule scores (from tag score_XXX or from YaraRuleScoreDefault in config)
    Dangerous - is DangerousThreshold reached
*/