VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
637 stars 178 forks source link

rule.match(filepath) does not support paths with Chinese characters, Japanese kana, etc #252

Closed wwwab123 closed 3 months ago

wwwab123 commented 4 months ago

As I mentioned in the title, I found that the match() function of the yara-python library does not work properly in special paths containing some languages. I hope it can be compatible with paths containing these languages.

E4C09399-1D37-49EE-B622-84EF51901663 F58D1186-167C-4C52-B788-C9F886BF4A9C 2FAADFA4-92C2-4FBA-8124-1E4BA77BD70D

plusvic commented 3 months ago

Unfortunately this is a limitation in YARA itself, which doesn't support unicode file paths. This limitation is hard to fix, but the alternative is doing something like:

with open('Path/to/file', 'r') as f:
    rule.match(data=f.read())