Skip to content

Commit

Permalink
Added a basic IDA's plugin wrapper
Browse files Browse the repository at this point in the history
GUI: Added a basic IDA plugin wrapper for Diaphora
  • Loading branch information
joxeankoret committed May 20, 2024
1 parent a1575a1 commit d169965
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugin/README.md
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.
2 changes: 2 additions & 0 deletions plugin/diaphora_plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Diaphora]
path=/path/to/diaphora/
72 changes: 72 additions & 0 deletions plugin/diaphora_plugin.py
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()

0 comments on commit d169965

Please sign in to comment.