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

Feature Request: Add strftime and strptime-like functions to YARA's time module #232

Open
franps opened this issue Oct 28, 2024 · 0 comments

Comments

@franps
Copy link

franps commented Oct 28, 2024

Nowadays there is little support for comparing timestamps if they are not presented in epoch time. I had (and lost it) an example where metadata dates came in freetext strings, when I find it I'll share it.

To address this, I propose adding two new functions to the time module, inspired by Python's strftime and strptime where you could transform epoch into date format and vice versa.

This way we could do rules like:

import "time"
rule example {
strings:
$time1 = "2024-10-29"
condition:
pe.timestamp <= time.strptime($time1, "%Y-%m-%d")
)
}

All the examples that come to mind now are using the vt module: vt.metadata.exiftool["CreateDate"].
But this feature will probably allow some flexibility in future rules, even in free text matching.

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

No branches or pull requests

1 participant