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

explorer: fix exception when loaded in IDA hosted under idat #1341

Merged
merged 3 commits into from
Mar 2, 2023

Conversation

mike-hunhoff
Copy link
Collaborator

closes #1331

No issues identified when running the following command-line:

$ idat64.exe -A -Sdecompile_entry_points.py -Llogfile.txt <input_file>

(source)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased) section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed

@github-actions github-actions bot dismissed their stale review March 1, 2023 21:17

CHANGELOG updated or no update needed, thanks! 😄

Comment on lines -10 to -13

pixmap = QtGui.QPixmap()
pixmap.loadFromData(ICON)
QICON = QtGui.QIcon(pixmap)
Copy link
Collaborator Author

@mike-hunhoff mike-hunhoff Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source of the exception.

My initial thoughts: at some point capa_explorer.py is executed which imports capa/ida/plugin/__init__.py which imports capa/ida/plugin/icon.py resulting in execution of the referenced code. This code is invalid under idat because the Qt libraries are not loaded/init'd.

Copy link
Collaborator Author

@mike-hunhoff mike-hunhoff Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm by executing traceback.print_stack() at capa/ida/plugin/icon.py global scope when running IDA hosted under idat

Screen Shot 2023-03-01 at 2 51 38 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lesson learned: code stored at global scope of plugin and imports is executed even if the plugin returns PLUGIN_SKIP when its init method is called.

Comment on lines +241 to +245

pixmap = QtGui.QPixmap()
pixmap.loadFromData(ICON)

self.parent.setWindowIcon(QtGui.QIcon(pixmap))
Copy link
Collaborator Author

@mike-hunhoff mike-hunhoff Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from capa/ida/plugin/icon.py; see other comments for more details

Copy link
Collaborator

@mr-tz mr-tz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for investigating and fixing this.

@mike-hunhoff mike-hunhoff merged commit 9f3428e into master Mar 2, 2023
@mike-hunhoff mike-hunhoff deleted the fix/1331 branch March 2, 2023 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDA Capa Explorer - plugin causes issues if running ida in cmd batch mode.
2 participants