yara_tools icon indicating copy to clipboard operation
yara_tools copied to clipboard

adding hex string to rule

Open bufu1003 opened this issue 5 years ago • 1 comments

Is there a workaround at the moment for adding a string of bytes to a rule in Yara's format? Looked around in documentation/examples and I haven't found anything.

  • Eg:

    my_string = " 80 42 00 8b 4d 08 ba 01 00 00 00 ff d0 81 c4 00 01 00 00 5"

    Then programmatically build the rule such that I end up with:

    `$a = {80 42 00 8b 4d 08 ba 01 00 00 00 ff d0 81 c4 00 01 00 00 5}`
    

Thank you for help!

bufu1003 avatar Jul 24 '19 20:07 bufu1003

I'm sorry for the delay a bit of a hectic summer. I believe rule.add_binary_as_string should work for you. Let me know if it doesn't.

rule.add_binary_as_string(data="4d5a9000??000000??000000ffff0000")

matonis avatar Oct 24 '19 00:10 matonis