Open g0mxxm opened 1 month ago
Modify In log.py, I added an elif branch which successfully resolved the error related to the "StreamWrapper" device type. However, I am unsure where the device type of "StreamWrapper" comes from and whether this is the optimal solution for the problem.
for dev in logdevs:
if isinstance(dev, FileLike):
handler = StreamHandler(dev)
elif isinstance(dev, str):
handler = FileHandler(dev)
elif type(dev).__name__ == "StreamWrapper":
handler = StreamHandler(dev)
Now is OK!
Hi there..!
IDA Python keeps surprising all the time. This is essentially because its standard streams do not support the fileno
method, and the default logging stream is set to sys.stderr
. Then it fails to match to FileLike
and this is how we get the error message.
Though your modification works around the problem, is it not the 'right' way to fix this. I'll assign myself to fix this later on.
Okay, I'm looking forward to the revised version, and I'll take a good look at it when it's ready.
Describe the bug the log about this error: [INFO][qilingida:2066] ['D:\Code_Files\ARM\Qiling-Lab\qilinglab-aarch64'] [INFO][qilingida:1032] Rootfs: D:\Code_Files\qiling\examples\rootfs\arm64_linux [INFO][qilingida:1033] Custom user script: D:\Code_Files\IDA_DEV\IDA_QilingLab.py [INFO][qilingida:1034] Custom env: {} [INFO][qilingida:1042] Qiling is initialized successfully. Traceback (most recent call last): File "E:/Tools/IDA_Pro_7.7/plugins/qilingida.py", line 810, in activate self.action_handler.ql_handle_menu_action(self.action_type) File "E:/Tools/IDA_Pro_7.7/plugins/qilingida.py", line 2098, in ql_handle_menu_action [x.handler() for x in self.menuitems if x.action == action] File "E:/Tools/IDA_Pro_7.7/plugins/qilingida.py", line 2098, in
[x.handler() for x in self.menuitems if x.action == action]
File "E:/Tools/IDA_Pro_7.7/plugins/qilingida.py", line 1037, in ql_start
self.qlemu.start()
File "E:/Tools/IDA_Pro_7.7/plugins/qilingida.py", line 889, in start
self.ql = Qiling(argv=self.path, rootfs=self.rootfs, verbose=QL_VERBOSE.DEBUG, env=self.env, log_plain=True, *args, **kwargs)
File "C:\Users\g0mx\AppData\Roaming\Python\Python38\site-packages\qiling\core.py", line 169, in init
self._log_file_fd = setup_logger(self, log_devices, log_plain, log_override)
File "C:\Users\g0mx\AppData\Roaming\Python\Python38\site-packages\qiling\log.py", line 208, in setup_logger
raise TypeError(f'unexpected logging device type: {type(dev).name}')
TypeError: unexpected logging device type: StreamWrapper
Sample Code I use the script is the official "custom_script.py"
pictrue of error
Additional context I try to modify the log.py to add a class named "StreamWrapper", but the error is not resloved. I need help to resolve this error.