maaaaz / androwarn

Yet another static code analyzer for malicious Android applications
GNU Lesser General Public License v3.0
477 stars 159 forks source link

UnicodeEncodeError on Otter apk #28

Open StephenQuirolgico opened 4 years ago

StephenQuirolgico commented 4 years ago

Hi,

I've run into an Androwarn bug on following app:

https://play.google.com/store/apps/details?id=com.aisense.otter

Traceback (most recent call last):
File "/data/androwarn_1.6/androwarn-master/androwarn.py", line 96, in <module>
main()
File "/data/androwarn_1.6/androwarn-master/androwarn.py", line 91, in main
dump_analysis_results(data,sys.stdout)
File "/data/androwarn_1.6/androwarn-master/warn/report/report.py", line 93, in dump_analysis_results
flush_simple_string(wrapper.fill(element), file_descriptor)
File "/data/androwarn_1.6/androwarn-master/warn/report/report.py", line 67, in flush_simple_string
file.write("%s\n" % string)
UnicodeEncodeError: 'ascii' codec can't encode character '\u02ce' in position 68: ordinal not in range(128)

Can this be fixed or possibly ignored in the code so the analysis can complete?

Thanks in advance!

StephenQuirolgico commented 4 years ago

@maaaaz I found that this error was due to trying to read a unicode char as a string. I fixed this by changing string on line 67 of /warn/report.py to string.encode('utf-8').strip() and then changing line 90 to remove 'or isinstanceof(element,unicode).