Spaces:
Running
Running
Commit
·
5ed5cfe
1
Parent(s):
5ae5a27
dev
Browse files
main.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import shutil
|
3 |
import subprocess
|
4 |
import tempfile
|
5 |
-
|
6 |
|
7 |
def new_binary(file):
|
8 |
|
@@ -10,10 +10,9 @@ def new_binary(file):
|
|
10 |
shutil.copy2(file.name, TEMP_DIR)
|
11 |
|
12 |
# python3 generate.py --ghidra PATH_TO_GHIDRA_ANALYZEHEADLESS -t NUM_THREADS -n [NUM_FILES|None] -b BINARIES_DIR -o OUTPUT_DIR
|
|
|
13 |
output = subprocess.check_output(f"python /DIRTY/dataset-gen-ghidra/generate.py --ghidra /ghidra/support/analyzeHeadless -t 1 -b {TEMP_DIR} -o {OUTPUT_DIR}", shell=True)
|
14 |
-
print(output)
|
15 |
-
|
16 |
-
|
17 |
|
18 |
with gr.Blocks() as demo:
|
19 |
|
@@ -30,8 +29,6 @@ with gr.Blocks() as demo:
|
|
30 |
|
31 |
def file_change_fn(file, progress=gr.Progress()):
|
32 |
|
33 |
-
print("hi")
|
34 |
-
new_binary(file)
|
35 |
|
36 |
if file is None:
|
37 |
return {
|
@@ -40,6 +37,8 @@ with gr.Blocks() as demo:
|
|
40 |
else:
|
41 |
|
42 |
#fun_data = {42: 2, 43: 3}
|
|
|
|
|
43 |
progress(0, desc="Decompiling binary...")
|
44 |
#fun_data = get_all_dis(file.name)
|
45 |
|
|
|
2 |
import shutil
|
3 |
import subprocess
|
4 |
import tempfile
|
5 |
+
import sys
|
6 |
|
7 |
def new_binary(file):
|
8 |
|
|
|
10 |
shutil.copy2(file.name, TEMP_DIR)
|
11 |
|
12 |
# python3 generate.py --ghidra PATH_TO_GHIDRA_ANALYZEHEADLESS -t NUM_THREADS -n [NUM_FILES|None] -b BINARIES_DIR -o OUTPUT_DIR
|
13 |
+
print("Running DIRTY-Ghidra...", file=sys.stderr)
|
14 |
output = subprocess.check_output(f"python /DIRTY/dataset-gen-ghidra/generate.py --ghidra /ghidra/support/analyzeHeadless -t 1 -b {TEMP_DIR} -o {OUTPUT_DIR}", shell=True)
|
15 |
+
print(output, file=sys.stderr)
|
|
|
|
|
16 |
|
17 |
with gr.Blocks() as demo:
|
18 |
|
|
|
29 |
|
30 |
def file_change_fn(file, progress=gr.Progress()):
|
31 |
|
|
|
|
|
32 |
|
33 |
if file is None:
|
34 |
return {
|
|
|
37 |
else:
|
38 |
|
39 |
#fun_data = {42: 2, 43: 3}
|
40 |
+
print("hi")
|
41 |
+
new_binary(file)
|
42 |
progress(0, desc="Decompiling binary...")
|
43 |
#fun_data = get_all_dis(file.name)
|
44 |
|