Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement time module #17

Merged
merged 7 commits into from
Aug 18, 2023
Merged

Conversation

RonnieSalomonsen
Copy link
Contributor

Port of the time module.

I've implemented time.now(), no rule changes should be needed. Used @Blacksyke magic module as template for this module. @wxsBSD and @Blacksyke decided it was best to add a minimal protobuf specification rather than hack the build scripts to account for modules that only have exported functions and return no data, like this one.

cargo test --package yara-x --lib --features time-module -- modules::time::tests --nocapture

   Compiling yara-x v0.1.0 (yara-x/yara-x)
    Finished test [unoptimized + debuginfo] target(s) in 1.76s
     Running unittests src/lib.rs (target/debug/deps/yara_x-56a7c9914ffab9dd)

running 1 test
test modules::time::tests::e2e_test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 0.19s

@RonnieSalomonsen
Copy link
Contributor Author

RonnieSalomonsen commented Apr 10, 2023

Cleaned up the code for Time module and added unit test to module source as a sub module. Let me know what you think.

cargo test --package yara-x --lib --features time-module -- modules::time --nocapture

   Compiling yara-x v0.1.0 (yara-x/yara-x)
    Finished test [unoptimized + debuginfo] target(s) in 7.41s
     Running unittests src/lib.rs (target/debug/deps/yara_x-66a842ed67eaa9e0)

running 1 test
test modules::time::tests::end2end ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 0.17s

yara-x/src/modules/time.rs Outdated Show resolved Hide resolved
@plusvic
Copy link
Member

plusvic commented Apr 12, 2023

Also, don't forget to run rustfmt on the source code before committing. My advice is configuring your IDE to do so automatically on file save.

@RonnieSalomonsen
Copy link
Contributor Author

RonnieSalomonsen commented Apr 12, 2023

Thank. I have configured vscode to run rust.analyzer on save

@RonnieSalomonsen RonnieSalomonsen marked this pull request as ready for review April 20, 2023 17:18
@plusvic plusvic changed the title Time module feat: implement time module Aug 18, 2023
@plusvic plusvic merged commit 8d0a143 into VirusTotal:main Aug 18, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants