Skip to content

Commit 668849e

Browse files
committed
Bump libbs version. Drop Ghidra below 12.
1 parent f9a0658 commit 668849e

File tree

4 files changed

+44
-60
lines changed

4 files changed

+44
-60
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you are looking for the paper repo, find it [here](https://github.com/mahaloz
1616
DAILA interacts with the decompiler abstractly through the [LibBS](https://github.com/binsync/libbs) library.
1717
This allows DAILA to support the following decompilers:
1818
- IDA Pro: **>= 8.4**
19-
- Ghidra: **>= 11.1**
19+
- Ghidra: **>= 12.0**
2020
- Binary Ninja: **>= 2.4**
2121
- angr-management: **>= 9.0**
2222

@@ -44,7 +44,9 @@ This will also download the VarBERT models for you through the [VarBERT API](htt
4444
If you happen to be installing DAILA on a machine that won't have internet access, like a secure network, you can use our Docker image in the [Docker Container](#docker-container) section.
4545

4646
### Ghidra Extra Steps
47-
You need to do a few extra steps to get Ghidra working.
47+
You need to do a few extra steps to get Ghidra working. First, you must be running in PyGhidra mode. You can do this
48+
by going to your Ghidra install directory and running `./support/pyghidraRun`.
49+
4850
Next, enable the DAILA plugin:
4951
1. Start Ghidra and open a binary
5052
2. Goto the `Windows > Script Manager` menu

dailalib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.18.0"
1+
__version__ = "3.19.0"
22

33
import os
44
# stop LiteLLM from querying at all to the remote server

dailalib/daila_plugin.py

Lines changed: 38 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,50 @@
22
# @author mahaloz
33
# @category AI
44
# @menupath Tools.DAILA.Start DAILA Backend
5+
# @runtime PyGhidra
56

67

7-
python_library_command = "dailalib -s ghidra"
8-
shell_library_command = "daila -s ghidra"
98
def create_plugin(*args, **kwargs):
109
from dailalib import create_plugin as _create_plugin
1110
return _create_plugin(*args, **kwargs)
1211

13-
# =============================================================================
14-
# LibBS generic plugin loader (don't touch)
15-
# =============================================================================
16-
17-
import sys
18-
# Python 2 has special requirements for Ghidra, which forces us to use a different entry point
19-
# and scope for defining plugin entry points
20-
if sys.version[0] == "2":
21-
# Do Ghidra Py2 entry point
22-
import subprocess
23-
from libbs_vendored.ghidra_bridge_server import GhidraBridgeServer
24-
from distutils.spawn import find_executable
25-
cmd = shell_library_command.split(" ")
26-
if not find_executable(cmd[0]):
27-
# fallback to doing python style module call
28-
python_end = ["-m"] + python_library_command.split(" ")
29-
python_exec = "python" if find_executable("python") else "python3"
30-
cmd = [python_exec] + python_end
31-
32-
GhidraBridgeServer.run_server(background=True)
33-
print("[+] Starting the backend now...")
34-
try:
35-
process = subprocess.Popen(cmd)
36-
except Exception as e:
37-
print("[!] Failed to run the backend command", cmd, "because", e)
38-
39-
if process.poll() is not None:
40-
raise RuntimeError(
41-
"Failed to run the Python3 backed. It's likely Python3 is not in your Path inside Ghidra.")
42-
else:
43-
# Try plugin discovery for other decompilers
44-
try:
45-
import idaapi
46-
has_ida = True
47-
except ImportError:
48-
has_ida = False
49-
try:
50-
import angrmanagement
51-
has_angr = True
52-
except ImportError:
53-
has_angr = False
54-
55-
if not has_ida and not has_angr:
56-
create_plugin()
57-
elif has_angr:
58-
from angrmanagement.plugins import BasePlugin
59-
class AngrBSPluginThunk(BasePlugin):
60-
def __init__(self, workspace):
61-
super().__init__(workspace)
62-
globals()["workspace"] = workspace
63-
self.plugin = create_plugin()
64-
65-
def teardown(self):
66-
pass
12+
try:
13+
import idaapi
14+
has_ida = True
15+
except ImportError:
16+
has_ida = False
17+
try:
18+
import angrmanagement
19+
has_angr = True
20+
except ImportError:
21+
has_angr = False
22+
try:
23+
import ghidra
24+
has_ghidra = True
25+
except ImportError:
26+
has_ghidra = False
27+
try:
28+
import binaryninja
29+
has_binja = True
30+
except ImportError:
31+
has_binja = False
32+
33+
34+
if has_ghidra or has_binja:
35+
create_plugin()
36+
elif has_angr:
37+
from angrmanagement.plugins import BasePlugin
38+
class AngrBSPluginThunk(BasePlugin):
39+
def __init__(self, workspace):
40+
super().__init__(workspace)
41+
globals()["workspace"] = workspace
42+
self.plugin = create_plugin()
43+
44+
def teardown(self):
45+
pass
46+
elif has_ida:
47+
# IDA will call create_plugin automatically
48+
pass
6749

6850

6951
def PLUGIN_ENTRY(*args, **kwargs):

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install_requires =
1717
litellm>=1.44.27
1818
tiktoken
1919
Jinja2
20-
libbs[ghidra]>=2.10.0
20+
libbs[ghidra]>=3.1.0
2121

2222
python_requires = >= 3.10
2323
include_package_data = True

0 commit comments

Comments
 (0)