Hugal31 / yara-rust

Rust bindings for VirusTotal/Yara
Apache License 2.0
77 stars 28 forks source link

Add callback API into Rules #33

Closed ikrivosheev closed 3 years ago

ikrivosheev commented 3 years ago

Hello @Hugal31 , sorry for my english, I will try to describe what I want to do.

  1. I kept the old api for backward compatibility
  2. Callback api provides more control over scanning
  3. I am writing an engine that will be integrated with python. To avoid converting from a Vec to PyList, I want to immediately add Rule to PyList

If this PR is Ok, I can write Callback API for Scanner

ikrivosheev commented 3 years ago

Thanks for your PR, it looks great! I left a few comments for things I'd like to change. Could you also add a few unit tests please?

Thank you for review!

  1. Fix memory leak
  2. Add more tests for callback

I have a question: Scanner callback API make similar Rule callback API or set callback into Scanner, like this:

let rules = Rules...;
let scanner = rules.scanner();
scanner.set_callback(...);
scanner.set_timeout(...);

?

Hugal31 commented 3 years ago

I have a question: Scanner callback API make similar Rule callback API or set callback into Scanner, like this:

let rules = Rules...;
let scanner = rules.scanner();
scanner.set_callback(...);
scanner.set_timeout(...);

?

I'm not sure. I think I prefer to keep it as the Rule API, it might be more convenient to use closures.

ikrivosheev commented 3 years ago

@Hugal31, I add Scanner callback API

ikrivosheev commented 3 years ago

@Hugal31 rebase master.

Can you make release? I need this changes in project

Hugal31 commented 3 years ago

v0.8.0 released!