Frida-ps中文显示乱码问题
本文最后更新于 2025-08-18,文章内容可能已经过时。
前言
在进行测试的时候,很多时候因为Android版本,高版本frida会报process terminate或者其他错误,导致只能对Frida进行降级,但当降级过后可能会出现使用frida-ps -Uai命令查看进程的时候,中文出现乱码的状态,因此需要对frida文件进行修改
环境信息
- frida: 11.0.8
- frida-tools: 无(老版本frida似乎没有frida-tools)
- frida-server: 11.0.8
- 测试设备: Nexus 5
- 设备系统:Android6.0.1
解决方法
当frida出现乱码时,如下图:

进入到frida的安装包中找到application.py文件(图为低版本frida目录结构图,高版本frida在frida-tools文件夹中)

找到ConsoleApplication类下的_print函数(低版本大概在333行左右)
# 原始的
# def _print(self, *args, **kwargs):
# encoded_args = []
# if sys.version_info[0] >= 3:
# string_type = str
# decoder = "unicode-escape"
# else:
# string_type = unicode
# decoder = "string-escape"
# encoding = sys.stdout.encoding or 'UTF-8'
# for arg in args:
# if isinstance(arg, string_type):
# encoded_args.append(arg.encode(encoding, errors='replace').decode(decoder, errors='replace'))
# else:
# encoded_args.append(arg)
# print(*encoded_args, **kwargs)
# self._console_state = ConsoleState.TEXT
# frida-tools抄的(修改成以下代码)
def _print(self, *args, **kwargs):
encoded_args = []
encoding = sys.stdout.encoding or 'UTF-8'
if encoding == 'UTF-8':
encoded_args = args
else:
if sys.version_info[0] >= 3:
string_type = str
else:
string_type = unicode
for arg in args:
if isinstance(arg, string_type):
encoded_args.append(arg.encode(encoding, errors='backslashreplace').decode(encoding))
else:
encoded_args.append(arg)
print(*encoded_args, **kwargs)
self._console_state = ConsoleState.TEXT
保存后重新运行即可

本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 苇逸
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果