Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging issues caused by IDA custom stderr #1493

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion qiling/extensions/idaplugin/qilingida.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,13 @@ def __init__(self):
self.env = {}

def start(self, *args, **kwargs):
self.ql = Qiling(argv=self.path, rootfs=self.rootfs, verbose=QL_VERBOSE.DEBUG, env=self.env, log_plain=True, *args, **kwargs)
# ida replaces sys.stderr with their own customized class that is not fully compatible with the
# standard stream protocol. here we patch stderr replacement to make it look like a proper file.
# this has to happen before Qiling init
if not hasattr(sys.stderr, 'fileno'):
setattr(sys.stderr, 'fileno', lambda: sys.__stderr__.fileno())

self.ql = Qiling(argv=self.path, rootfs=self.rootfs, verbose=QL_VERBOSE.DEBUG, env=self.env, *args, **kwargs)

if sys.platform != 'win32':
self.ql.os.stdin = QlEmuMisc.QLStdIO('stdin', sys.__stdin__.fileno())
Expand Down
Loading