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

TypeError: 'yara.StringMatch' object is not subscriptable #44

Open
4hem opened this issue Jul 11, 2023 · 4 comments
Open

TypeError: 'yara.StringMatch' object is not subscriptable #44

4hem opened this issue Jul 11, 2023 · 4 comments

Comments

@4hem
Copy link

4hem commented Jul 11, 2023

Failed while executing plugin_t.run():
Traceback (most recent call last):
File "D:/tools/IDA_Pro_7.7/plugins/findcrypt3.py", line 224, in run
self.search()
File "D:/tools/IDA_Pro_7.7/plugins/findcrypt3.py", line 180, in search
values = self.yarasearch(memory, offsets, rules)
File "D:/tools/IDA_Pro_7.7/plugins/findcrypt3.py", line 197, in yarasearch
self.toVirtualAddress(string[0], offsets),
TypeError: 'yara.StringMatch' object is not subscriptable

@serv0id
Copy link
Contributor

serv0id commented Jul 22, 2023

#45

@muha2xmad
Copy link

The same problem here with yara-python 4.3.1

@muha2xmad
Copy link

I solved this problem by installing yara-python 4.2

@1198287349
Copy link

The yarsearch function needs to be modified as follows:

def yarasearch(self, memory, offsets, rules):
print(">>> start yara search")
values = list()
matches = rules.match(data=memory)
for match in matches:
for stringR in match.strings:
name = match.rule
for string in stringR.instances:
if name.endswith("API"):
try:
name = name + "
" + idc.GetString(self.toVirtualAddress(string.offset, offsets))
except:
pass
value = [
self.toVirtualAddress(string.offset, offsets),
match.namespace,
name + "" + hex(self.toVirtualAddress(string.offset, offsets)).lstrip("0x").rstrip("L").upper(),
stringR.identifier,
repr(string.matched_data)
]
idaapi.set_name(value[0], name
+ "
"
+ hex(self.toVirtualAddress(string.offset, offsets)).lstrip("0x").rstrip("L").upper()
, 0)
values.append(value)
print("<<< end yara search")
return values

7a6570 added a commit to 7a6570/findyara-ida that referenced this issue Jan 30, 2024
TypeError: 'yara.StringMatch' object is not subscriptable
polymorf/findcrypt-yara#44
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

4 participants