ysard / mi_remote_database

Proof of concept aiming to reproduce and query the infrared code database (IRDB) used by the Xiaomi *Mi Remote* application.
GNU Affero General Public License v3.0
52 stars 8 forks source link

Always explicitely use utf-8 when reading/writing files #5

Closed Biswa96 closed 1 year ago

Biswa96 commented 1 year ago
Explicitely pass utf-8 as an encoding to fix the following errors in Windows.

UnicodeEncodeError: 'charmap' codec can't encode characters in position 106-108: character maps to <undefined>
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2514: character maps to <undefined>

It uses the locale encoding by default otherwise which is probably
not what we want when generating files, and also explodes with Unicode
on Windows.

Note: Missing encoding arguments can be detected on all platforms starting with
Python 3.10 if the PYTHONWARNDEFAULTENCODING env var is set, see
https://peps.python.org/pep-0597 for more details.
ysard commented 1 year ago

The joys of windows... :p But you are right, encodings should be explicitly set. Thanks for the PR, can you just fix the typo of spaces on both sides of the '=' sign (remove them), I will merge after that.

Biswa96 commented 1 year ago

Thanks for the review. I have removed the extra spaces.

ysard commented 1 year ago

Thanks ;)

Biswa96 commented 1 year ago

BTW, I have read your blog post. But I failed to get any result with those techniques. I ended up using frida to hook okhttp methods and I got the same result.

ysard commented 1 year ago

You can't get the application urls with the patch for MITM proxy ? I've never used Frida yet, and that's a mistake :p

Biswa96 commented 1 year ago

You can't get the application urls with the patch for MITM proxy ?

I do not have the setup for MITM proxy. Also I did not try that step. I only tried to get the parts of URL and IR code in logcat after modifying the smali code.

Tried it so many times > gave up > write one frida script > 💥

ysard commented 1 year ago

Ok :D It seems that there is a problem with the API now : #4 Did you get it too ? Maybe the API has changed...