-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUI: Added a basic IDA plugin wrapper for Diaphora
- Loading branch information
1 parent
a1575a1
commit d169965
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Diaphora as an integrated IDA plugin | ||
|
||
This is a very basic wrapper for integrating Diaphora as a plugin in IDA Pro. | ||
In order to install it just do the following: | ||
|
||
* Copy `diaphora_plugin.py` and `diaphora_plugin.cfg` to the IDA's plugins directory. | ||
* Edit `diaphora_plugin.cfg` and set the `path` value to the Diaphora's directory. | ||
|
||
This is a very basic wrapper. It will be enhanced in the future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Diaphora] | ||
path=/path/to/diaphora/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
""" | ||
Diaphora, a binary diffing tool | ||
Copyright (c) 2015-2024, Joxean Koret | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
""" | ||
|
||
import os | ||
import sys | ||
import configparser | ||
|
||
import idaapi | ||
from idaapi import warning | ||
|
||
#------------------------------------------------------------------------------- | ||
def resolve_diaphora(): | ||
config_dir = os.path.dirname(__file__) | ||
config_file = os.path.join(config_dir, "diaphora_plugin.cfg") | ||
if not os.path.exists(config_file): | ||
warning(f"The configuration file {config_file} does not exist.") | ||
return None | ||
|
||
config = configparser.ConfigParser() | ||
config.read(config_file) | ||
|
||
path = config["Diaphora"]["path"] | ||
sys.path.append(path) | ||
|
||
from diaphora_ida import main | ||
return main | ||
|
||
#------------------------------------------------------------------------------- | ||
class DiaphoraPlugin(idaapi.plugin_t): | ||
wanted_name = "Diaphora: Run Diaphora" | ||
version = "3.2.0" | ||
wanted_hotkey = "" | ||
comment = "Diaphora by joxeankoret" | ||
website = "https://github.com/joxeankoret/diaphora" | ||
help = "Export the current binary or diff against another binary" | ||
flags = 0 | ||
|
||
def init(self): | ||
self.diaphora_main = None | ||
return idaapi.PLUGIN_KEEP | ||
|
||
def term(self): | ||
pass | ||
|
||
def run(self, arg): | ||
if self.diaphora_main is None: | ||
self.diaphora_main = resolve_diaphora() | ||
|
||
if self.diaphora_main is not None: | ||
self.diaphora_main() | ||
|
||
return True | ||
|
||
#------------------------------------------------------------------------------- | ||
def PLUGIN_ENTRY(): | ||
return DiaphoraPlugin() | ||
|