Spaces:
Running
Running
Commit
·
f99e17c
1
Parent(s):
9887ae8
Improve dup location and fix duplicate binary bug.
Browse files- Dockerfile +1 -1
- main.py +11 -2
Dockerfile
CHANGED
|
@@ -27,7 +27,7 @@ RUN unzip ghidrathon/Ghidrathon-v4.0.0.zip -d /ghidra/Ghidra/Extensions
|
|
| 27 |
|
| 28 |
WORKDIR /
|
| 29 |
|
| 30 |
-
RUN git clone -b main https://github.com/edmcman/DIRTY # 09-
|
| 31 |
#ADD ./DIRTY /DIRTY
|
| 32 |
|
| 33 |
RUN --mount=type=cache,target=/root/.cache pip install --upgrade -r /DIRTY/requirements.txt
|
|
|
|
| 27 |
|
| 28 |
WORKDIR /
|
| 29 |
|
| 30 |
+
RUN git clone -b main https://github.com/edmcman/DIRTY # 09-25-24
|
| 31 |
#ADD ./DIRTY /DIRTY
|
| 32 |
|
| 33 |
RUN --mount=type=cache,target=/root/.cache pip install --upgrade -r /DIRTY/requirements.txt
|
main.py
CHANGED
|
@@ -24,14 +24,23 @@ def get_functions(file):
|
|
| 24 |
|
| 25 |
with tempfile.TemporaryDirectory() as TEMP_DIR:
|
| 26 |
|
|
|
|
| 27 |
o = subprocess.run(
|
| 28 |
-
f"/ghidra/support/analyzeHeadless {GHIDRA_PROJECT_DIR} {file_hash} -import {file}
|
| 29 |
shell=True,
|
| 30 |
capture_output=True,
|
| 31 |
encoding="utf8"
|
| 32 |
)
|
| 33 |
if o.returncode != 0:
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
if not os.path.exists(f"{TEMP_DIR}/funcs.json"):
|
| 37 |
raise gr.Error(f"DIRTY Ghidra failed to produce output: {o.stdout}")
|
|
|
|
| 24 |
|
| 25 |
with tempfile.TemporaryDirectory() as TEMP_DIR:
|
| 26 |
|
| 27 |
+
# First import the file
|
| 28 |
o = subprocess.run(
|
| 29 |
+
f"/ghidra/support/analyzeHeadless {GHIDRA_PROJECT_DIR} {file_hash} -import {file} 2>&1",
|
| 30 |
shell=True,
|
| 31 |
capture_output=True,
|
| 32 |
encoding="utf8"
|
| 33 |
)
|
| 34 |
if o.returncode != 0:
|
| 35 |
+
if not "Found conflicting program file in project:" in o.stdout:
|
| 36 |
+
raise gr.Error(f"Unable to run Ghidra on {file}: {o.stdout}")
|
| 37 |
+
|
| 38 |
+
o = subprocess.run(
|
| 39 |
+
f"/ghidra/support/analyzeHeadless {GHIDRA_PROJECT_DIR} {file_hash} -process -postscript /home/user/app/scripts/dump_functions.py {TEMP_DIR}/funcs.json 2>&1",
|
| 40 |
+
shell=True,
|
| 41 |
+
capture_output=True,
|
| 42 |
+
encoding="utf8"
|
| 43 |
+
)
|
| 44 |
|
| 45 |
if not os.path.exists(f"{TEMP_DIR}/funcs.json"):
|
| 46 |
raise gr.Error(f"DIRTY Ghidra failed to produce output: {o.stdout}")
|