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

Bugfix for PE identification & produce condition in illegal syntax for super rules under certain args #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions yarGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ def generate_rules(file_strings, file_opcodes, super_rules, file_info, inverse_s
condition_pe = []
condition_pe_part1 = []
condition_pe_part2 = []
if not args.noextras and file_info[filePath]["magic"] == "MZ":
if not args.noextras and file_info[filePath]["magic"] == binascii.hexlify(b"MZ").decode('ascii'):
# Add imphash - if certain conditions are met
if file_info[filePath]["imphash"] not in good_imphashes_db and file_info[filePath]["imphash"] != "":
# Comment to imphash
Expand Down Expand Up @@ -1423,7 +1423,8 @@ def generate_rules(file_strings, file_opcodes, super_rules, file_info, inverse_s
cond_op = " and all of ($op*)"

condition2 = "( {0} ){1}".format(cond_combined, cond_op)
conditions.append(" and ".join([condition_strings, condition2]))
# condition_strings could be ""
conditions.append(" and ".join(filter(lambda x: x != "", [condition_strings, condition2])))

# 3nd condition
# In memory detection base condition (no magic, no filesize)
Expand Down