frida包中application.py
# 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 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