Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cb674cb
Add a Settings button so the server is easy to set
r0ny123 Oct 15, 2026
5d97f3a
Merge main into settings-button
r0ny123 Oct 15, 2026
f895c18
Use one icon set for the toolbar and tabs
r0ny123 Oct 19, 2026
601ac73
Merge main into settings-button
r0ny123 Oct 22, 2026
b2c2e28
Merge branch 'settings-button' into lucide-icons
r0ny123 Oct 22, 2026
20d00dc
Give the Ghidra tabs the new icons too
r0ny123 Oct 22, 2026
e1dd145
Keep answers and credentials with the server they belong to
r0ny123 Oct 22, 2026
9e6aaa1
Merge branch 'settings-button' into lucide-icons
r0ny123 Oct 22, 2026
6487082
Tint the Ghidra icons and finish the icon set
r0ny123 Oct 22, 2026
0452bd0
Close the last gaps in the server switch
r0ny123 Oct 22, 2026
6c72bec
Merge branch 'settings-button' into lucide-icons
r0ny123 Oct 22, 2026
8400b98
Tint the Ghidra window icon too and scope the icon changelog
r0ny123 Oct 22, 2026
97c06dd
Test that every stored answer is written under the switch lock
r0ny123 Oct 22, 2026
a07f330
Merge branch 'settings-button' into lucide-icons
r0ny123 Oct 22, 2026
0f9bfe7
Wait for the target function's matches in the Ghidra GUI run
r0ny123 Oct 22, 2026
5e71c40
Test the function-offset store and the client swap under the switch lock
r0ny123 Oct 22, 2026
749de38
Merge branch 'settings-button' into lucide-icons
r0ny123 Oct 22, 2026
0514b73
Cache block matches under the switch lock
r0ny123 Nov 10, 2026
7466385
Retry the tab click in the Ghidra GUI run
r0ny123 Nov 10, 2026
cfde6ba
Merge branch 'settings-button' into lucide-icons
r0ny123 Nov 10, 2026
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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Lint, tests, packaging and metadata checks are listed in
## Architecture primer

- **Entry** (`mcrit_plugin/ida/ida_mcrit.py`) registers IDA menus/actions/hotkeys and the MCRIT widget subviews.
- **`McritInterface`** owns the connection to the MCRIT server. Uploads, the Function and Block Scope queries, fetching a matching result and fetching labels go through `Backend.run_request`: on Binary Ninja they run as background tasks, named in the status bar; on IDA they run on a small worker pool and a queued Qt signal hands each result back to the main thread (not an IDA timer: requests start inside the cursor-settle timer's callback, and IDA 9.4 hangs in `register_timer` called there); headless runs them synchronously. The widgets drop a live query's answer once the cursor has moved to another function. The connection check, the family and sample list download and the lookup of the converted sample also run in the background. IDA's API is main-thread only: on IDA, `run_background` work runs on a worker too, the backend methods that read the database run on the main thread through `execute_sync`, and the export reads the database into a snapshot there (`SmdaInterfaceSnapshot`, through smda's IDAPython backend rather than its slower ida_domain one) before disassembling and hashing it on the worker.
- **`McritInterface`** owns the connection to the MCRIT server. Uploads, the Function and Block Scope queries, fetching a matching result and fetching labels go through `Backend.run_request`: on Binary Ninja they run as background tasks, named in the status bar; on IDA they run on a small worker pool and a queued Qt signal hands each result back to the main thread (not an IDA timer: requests start inside the cursor-settle timer's callback, and IDA 9.4 hangs in `register_timer` called there); headless runs them synchronously. The widgets drop a live query's answer once the cursor has moved to another function. The connection check, the family and sample list download and the lookup of the converted sample also run in the background. IDA's API is main-thread only: on IDA, `run_background` work runs on a worker too, the backend methods that read the database run on the main thread through `execute_sync`, and the export reads the database into a snapshot there (`SmdaInterfaceSnapshot`, through smda's IDAPython backend rather than its slower ida_domain one) before disassembling and hashing it on the worker. A request pins its client and server generation with `_pinConnection` and stores its answer inside `with self._storing(generation)`, so an answer from a server the session left is dropped; every new method that writes session state has to do the same.
- **`McritClient`** (internalized under `mcrit_plugin/core/minimcrit/`) is the HTTP client speaking the MCRIT REST API. The plugin intentionally vendors a minified copy of the core client so it has no hard dependency on the `mcrit` package.
- **IDB→SMDA conversion** uses SMDA (optionally as the analysis backend via `use_smda_for_analysis`); results feed matching and label sync.
- **Widgets** render matches/blocks/functions/overview and are built on PySide6 through `QtShim`.
Expand Down
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,28 @@ Ninja or Ghidra applies to that plugin only.
program. Reports are exported from Ghidra's own analysis through SMDA (4.9.0 or newer), matched
local blocks are tinted in the listing with markers that are not saved with the program, remote
CFGs open in Ghidra's graph view, and the settings are under Tool Options > MCRIT. It runs from
this repository's `ghidra_scripts` folder; see the README for setup. Not released yet; versioned
on its own from 0.1.0.
this repository's `ghidra_scripts` folder; see the README for setup. Its toolbar and tabs use
the same icons, at 24 px in the toolbar and in the theme's text colour from when the window
opens. Not released yet; versioned on its own from 0.1.0.
- IDA and Binary Ninja: a Settings button on the toolbar, a "Change..." link on the remote server
line, and a Settings entry in the menus (IDA: Edit → Plugins → MCRIT4IDA Settings...; Binary
Ninja: Plugins → MCRIT → Settings). In IDA they open the Plugin Settings Manager on mcrit-ida when
`ida-settings-editor` is installed; in Binary Ninja, Settings on the MCRIT group. Without the
settings editor, IDA shows the plugin's own form for the server, API token, username and timeout;
it saves only the fields you changed, greys out the ones `config_override.json` forces, and
connects again at once. Closing the settings window or tab opened this way also picks up a
changed token, username or timeout without reopening the plugin. A changed server is picked up
the same way until the plugin holds results from the current one; after that, it says so, keeps
the current server with its token and username, and reopening the plugin switches. An answer
that arrives from the previous server after a switch is dropped.
- A failed connection check while the server is still the default `http://127.0.0.1:8000/` points
at the Settings button (Ghidra: Edit > Tool Options > MCRIT).

### Changed

- IDA and Binary Ninja: new toolbar and tab icons from one set (Lucide, plus the YARA mark from
YARA-X), each tab with its own icon; credits and licences are in `icons/NOTICE.md`. The toolbar
icons are 24 px in both (IDA drew them at 32 px).

### Fixed

Expand All @@ -26,6 +46,9 @@ Ninja or Ghidra applies to that plugin only.
example, branch targets kept their exact bytes. The escaping now follows the report's
architecture; one without an SMDA escaper keeps its raw bytes. Copy Escaped Bytes falls back to
raw bytes like the rule text when escaping fails, instead of copying nothing.
- IDA and Binary Ninja: the toolbar and tab icons take the theme's text color, also after a theme
change, so they are visible on dark themes; disabled toolbar icons show dimmed instead of almost
black.

## [2.1.1] - 2026-10-15

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ For offline machines, each release has a wheelhouse bundle: unpack it and run `p
Settings are handled by [ida-settings](https://github.com/williballenthin/ida-settings):

- HCLI: `hcli plugin config mcrit-ida set mcrit_server https://mcrit.example.com/api/` (`list`, `get`, `export` and `import` also work)
- GUI: install `ida-settings-editor` and use Edit → Plugins → Plugin Settings Manager
- GUI: the Settings button on the MCRIT toolbar (also Edit → Plugins → MCRIT4IDA Settings...). With `ida-settings-editor` installed it opens the Plugin Settings Manager on mcrit-ida; without it, a small form for the server, API token, username and timeout.
- File: put a `config_override.json` next to `ida_mcrit.py`. Its keys take precedence over the other two, so keep only the ones you want to force; `docs/config_override.json.template` shows the format, and the plugin prints the keys it forces when it loads.

### Use
Expand All @@ -79,7 +79,7 @@ Install MCRIT from the Extension Manager, or clone this repository into your Bin

### Configure

Settings are under Settings → MCRIT, with the same keys as the IDA plugin. Where a system keychain is available, an API token entered there is moved into it and the field is cleared; otherwise the token stays in the Settings entry. Plugins → MCRIT → Clear Stored API Token removes it. The sidebar reads the connection settings (server, token, username, timeout) when it opens for a file, so reopen the file after changing them. A `config_override.json` in the plugin's folder, next to `plugin.json`, takes precedence as it does in IDA.
Settings are under Settings → MCRIT, with the same keys as the IDA plugin; the Settings button on the sidebar toolbar and Plugins → MCRIT → Settings open them there. Where a system keychain is available, an API token entered there is moved into it and the field is cleared; otherwise the token stays in the Settings entry. Plugins → MCRIT → Clear Stored API Token removes it. The sidebar reads the connection settings (server, token, username, timeout) when it opens for a file, and again when you close the Settings tab its button opened (a different server only until the sidebar holds results from the current one); after changing them any other way, reopen the file. A `config_override.json` in the plugin's folder, next to `plugin.json`, takes precedence as it does in IDA.

### Use

Expand Down Expand Up @@ -147,7 +147,8 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history.

## License

GPL-3.0, see [LICENSE](LICENSE).
GPL-3.0, see [LICENSE](LICENSE). The third-party icons and their licences are listed in
[icons/NOTICE.md](icons/NOTICE.md).

## Authors

Expand Down
93 changes: 93 additions & 0 deletions icons/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Icon credits

The toolbar and tab icons are drawn from these sets and rendered to 48 px PNGs on a 2x grid.
`mcrit.png`, the plugin's logo, is this project's own.

## Lucide

`fingerprint_scan.png`, `cloud-upload.png`, `satellite_dish.png`, `export.png`, `settings.png`,
`blocks.png`, `compare.png`, `network.png` and `chart.png` are the Lucide icons `fingerprint-pattern`,
`cloud-upload`, `satellite-dish`, `file-down`, `settings-2`, `blocks`, `git-compare-arrows`,
`network` and `chart-column` (lucide-static 1.52.0, <https://lucide.dev>).

```text
ISC License

Copyright (c) 2026 Lucide Icons and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

---

The following Lucide icons are derived from the Feather project:

airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out

`cloud-upload` is Feather's `upload-cloud` under its Lucide name, so it falls under this licence too.

The MIT License (MIT) (for the icons listed above)

Copyright (c) 2013-present Cole Bemis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## YARA-X

`yara.png` is the YARA mark from the YARA-X playground
(<https://github.com/VirusTotal/yara-x/blob/main/playground/public/yara-mark.svg>), in one color.

```text
Copyright (c) 2024. The YARA-X Authors. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (
INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
Binary file added icons/blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/cloud-upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/compare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/fingerprint_scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/flag-triangle.png
Binary file not shown.
Binary file added icons/network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/puzzle.png
Binary file not shown.
Binary file removed icons/relationship.png
Binary file not shown.
Binary file modified icons/satellite_dish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/scan.png
Binary file not shown.
Binary file added icons/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/upload.png
Binary file not shown.
Binary file modified icons/yara.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions mcrit_plugin/binja/BinjaBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
class BinjaBackend(Backend):
name = "Binary Ninja"
plugin_name = "MCRIT4BinaryNinja"
reopen_hint = "reopen the file"

def __init__(self, bv):
self.bv = bv
Expand Down Expand Up @@ -247,6 +248,31 @@ def show_warning(self, message):
TITLE, message, MessageBoxButtonSet.OKButtonSet, MessageBoxIcon.WarningIcon
)

def open_settings(self, config):
from binaryninjaui import SettingsView, UIContext
from PySide6.QtWidgets import QApplication

from mcrit_plugin.binja.config import GROUP

context = UIContext.activeContext() or next(iter(UIContext.allContexts()), None)
if context is not None:
# the "Settings" action opens the Settings tab, or brings an open one to the front
context.globalActions().executeAction("Settings")
views = [w for w in QApplication.allWidgets() if isinstance(w, SettingsView)]
# with several windows open, watch the tab this window just showed
views.sort(key=lambda view: not context.mainWindow().isAncestorOf(view))
for view in views:
view.setDefaultGroupSelection(GROUP)
if views:
return views[0]
return None

def save_settings(self, values):
from mcrit_plugin.binja.config import set_setting

for key, value in values.items():
set_setting(key, value)

def theme_color(self, role, default):
try:
from binaryninjaui import getThemeColor
Expand Down
1 change: 1 addition & 0 deletions mcrit_plugin/binja/McritSidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def _has_report(session):
# (action name, handler(session) or None to only open the sidebar, enabled(session) or None when always available)
_ACTIONS = [
("MCRIT\\Show Sidebar", None, None),
("MCRIT\\Settings", lambda session: session.main_widget._onSettingsButtonClicked(), None),
(
"MCRIT\\Convert to SMDA Report",
lambda session: session.main_widget._onConvertSmdaButtonClicked(),
Expand Down
19 changes: 19 additions & 0 deletions mcrit_plugin/binja/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ def _get_secret(key, settings):
raise KeyError(key)


def set_setting(key, value):
full_key = f"{GROUP}.{key}"
settings = Settings()
if key in SECRET_SETTINGS:
provider = SecretsProvider.get(KEYCHAIN_PROVIDER)
if provider is not None and provider.has_data(full_key):
provider.delete_data(full_key)
settings.reset(full_key)
if value:
# moved into the keychain by the next read, as for a value typed into Settings
settings.set_string(full_key, value)
elif key in NUMBER_SETTINGS:
settings.set_integer(full_key, int(value))
elif isinstance(value, bool):
settings.set_bool(full_key, value)
else:
settings.set_string(full_key, value)


def clear_stored_secrets():
provider = SecretsProvider.get(KEYCHAIN_PROVIDER)
settings = Settings()
Expand Down
19 changes: 19 additions & 0 deletions mcrit_plugin/core/Backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ def ask_yes_no(self, prompt):
def show_warning(self, message):
"""Modal warning."""

# shown under the plugin's own connection form, e.g. where the remaining settings live
settings_hint = ""
# what rebuilds the session, so a new server can take over
reopen_hint = "reopen MCRIT"
# where the user changes the server, named in the hint after a failed connection check
settings_location = "the Settings button"

def open_settings(self, config):
"""Open the disassembler's own settings UI on this plugin and return its QWidget, or True
when it opened but cannot be watched for closing.

None means there is none, and the plugin shows its own connection form instead.
"""
return None

def save_settings(self, values):
"""Store the connection form's values (setting key -> value) in the settings store."""
raise NotImplementedError

def theme_color(self, role, default):
"""RGB tuple for a ScoreColorProvider.ThemeRole; None keeps the widget's own color and is
valid only for TEXT_ON_TINT.
Expand Down
1 change: 1 addition & 0 deletions mcrit_plugin/core/HeadlessMcritContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ def __init__(self, config, backend):
self.family_infos = None
self.function_id_to_offset = {}
self.function_matches = {}
self.blockhash_matches = {}
self.mcrit_interface = McritInterface(self, backend)
Loading
Loading