ejschwartz commited on
Commit
b1add05
·
1 Parent(s): bbc4bc2
Files changed (2) hide show
  1. Dockerfile +20 -4
  2. main.py +1 -3
Dockerfile CHANGED
@@ -6,16 +6,32 @@ WORKDIR /code
6
 
7
  COPY ./requirements.txt /code/requirements.txt
8
 
9
- RUN apt-get -y update && apt-get -y install -y python3-pip python-is-python3 git pkg-config libsentencepiece-dev
 
 
 
10
 
11
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  # Install DIRTY Ghidra
14
 
15
  WORKDIR /
16
 
17
- RUN git clone https://github.com/edmcman/DIRTY
18
- RUN pip install --no-cache-dir --upgrade -r /DIRTY/requirements.txt
 
 
19
 
20
  # Set up a new user named "user" with user ID 1000
21
  RUN useradd -m -u 1000 user
 
6
 
7
  COPY ./requirements.txt /code/requirements.txt
8
 
9
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
10
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
11
+ apt-get -y update && apt-get -y install -y python3-pip python-is-python3 \
12
+ git pkg-config libsentencepiece-dev nano sudo unzip
13
 
14
+ # RUN --mount=type=cache,target=/root/.npm
15
+ RUN --mount=type=cache,target=/root/.cache pip install --no-cache-dir --upgrade -r /code/requirements.txt
16
+
17
+ # Install Ghidrathon
18
+
19
+ WORKDIR /tmp/
20
+
21
+ RUN wget https://github.com/mandiant/Ghidrathon/releases/download/v4.0.0/Ghidrathon-v4.0.0.zip
22
+ RUN unzip Ghidrathon-v4.0.0.zip -d ghidrathon
23
+ RUN python -m pip install -r ghidrathon/requirements.txt
24
+ RUN python ghidrathon/ghidrathon_configure.py /ghidra
25
+ RUN unzip ghidrathon/Ghidrathon-v4.0.0.zip -d /ghidra/Ghidra/Extensions
26
 
27
  # Install DIRTY Ghidra
28
 
29
  WORKDIR /
30
 
31
+ #RUN git clone -b main https://github.com/edmcman/DIRTY
32
+ ADD ./DIRTY /DIRTY
33
+
34
+ RUN --mount=type=cache,target=/root/.cache pip install --no-cache-dir --upgrade -r /DIRTY/requirements.txt
35
 
36
  # Set up a new user named "user" with user ID 1000
37
  RUN useradd -m -u 1000 user
main.py CHANGED
@@ -9,13 +9,12 @@ def new_binary(file):
9
 
10
  with tempfile.TemporaryDirectory() as TEMP_DIR, tempfile.TemporaryDirectory() as OUTPUT_DIR:
11
  shutil.copy2(file.name, TEMP_DIR)
 
12
 
13
  # python3 generate.py --ghidra PATH_TO_GHIDRA_ANALYZEHEADLESS -t NUM_THREADS -n [NUM_FILES|None] -b BINARIES_DIR -o OUTPUT_DIR
14
  print("Running DIRTY-Ghidra...", file=sys.stderr)
15
  subprocess.run(f"python /DIRTY/dataset-gen-ghidra/generate.py --verbose --ghidra /ghidra/support/analyzeHeadless -t 1 -b {TEMP_DIR} -o {OUTPUT_DIR}", shell=True)
16
- subprocess.run(f"ls -lR {TEMP_DIR}", shell=True)
17
  subprocess.run(f"ls -lR {OUTPUT_DIR}", shell=True)
18
- subprocess.run(f"/ghidra/support/analyzeHeadless -h", shell=True)
19
 
20
 
21
  with gr.Blocks() as demo:
@@ -42,7 +41,6 @@ with gr.Blocks() as demo:
42
  else:
43
 
44
  #fun_data = {42: 2, 43: 3}
45
- print("hi")
46
  new_binary(file)
47
  progress(0, desc="Decompiling binary...")
48
  #fun_data = get_all_dis(file.name)
 
9
 
10
  with tempfile.TemporaryDirectory() as TEMP_DIR, tempfile.TemporaryDirectory() as OUTPUT_DIR:
11
  shutil.copy2(file.name, TEMP_DIR)
12
+ subprocess.run(f"ls -lR {TEMP_DIR}", shell=True)
13
 
14
  # python3 generate.py --ghidra PATH_TO_GHIDRA_ANALYZEHEADLESS -t NUM_THREADS -n [NUM_FILES|None] -b BINARIES_DIR -o OUTPUT_DIR
15
  print("Running DIRTY-Ghidra...", file=sys.stderr)
16
  subprocess.run(f"python /DIRTY/dataset-gen-ghidra/generate.py --verbose --ghidra /ghidra/support/analyzeHeadless -t 1 -b {TEMP_DIR} -o {OUTPUT_DIR}", shell=True)
 
17
  subprocess.run(f"ls -lR {OUTPUT_DIR}", shell=True)
 
18
 
19
 
20
  with gr.Blocks() as demo:
 
41
  else:
42
 
43
  #fun_data = {42: 2, 43: 3}
 
44
  new_binary(file)
45
  progress(0, desc="Decompiling binary...")
46
  #fun_data = get_all_dis(file.name)