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

Failed to generate rule by DATA with Python3 #6

Open
av-gantimurov opened this issue Oct 7, 2021 · 0 comments
Open

Failed to generate rule by DATA with Python3 #6

av-gantimurov opened this issue Oct 7, 2021 · 0 comments

Comments

@av-gantimurov
Copy link

Just took sample code from README.md

import codecs
from capstone import CS_ARCH_X86, CS_MODE_32
from mkyara import YaraGenerator

gen = YaraGenerator("normal", CS_ARCH_X86, CS_MODE_32)
gen.add_chunk(b"\x90\x90\x90", offset=1000)
gen.add_chunk(codecs.decode("6830800000E896FEFFFFC3", "hex"), offset=0x100)
gen.add_chunk(b"\x90\x90\x90\xFF\xD7", is_data=True)
rule = gen.generate_rule()
rule_str = rule.get_rule_string()
print(rule_str)

And got exception

File "/lib/python3.9/site-packages/mkyara/gen.py", line 149, in generate_rule
    rule_part = self.format_hex(chunk.data.encode("hex"))
AttributeError: 'bytes' object has no attribute 'encode'
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