VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
8.34k stars 1.45k forks source link

How to get condition string from rule via C API? #1998

Closed mavam closed 1 year ago

mavam commented 1 year ago

Say I'm processing matches in this callback:

int callback(YR_SCAN_CONTEXT* context, int message, void* message_data, void* user_data);

I get a YR_RULE* by casting message_data, and I've looked for a "condition" member in the the underlying YR_RULE struct, but I can't find anything here.

As I am reporting matches, it would be quite valuable context to also report the textual condition.

plusvic commented 1 year ago

You can't, compiled rules don't retain the original source code, so the condition's text is lost after compilation.