Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Support #109

Open
zjy-dev opened this issue Nov 22, 2024 · 0 comments
Open

Docker Support #109

zjy-dev opened this issue Nov 22, 2024 · 0 comments

Comments

@zjy-dev
Copy link

zjy-dev commented Nov 22, 2024

❤️It's an amazing repo❤️.

But install ghidra + ghidrathon is tiring😢, and I (maybe many others) need ghidra + ghidrathon on a remote server(headless mode) for something big.

So I've made a docker container that works well, and Dockerfile is below.

If you think this is a real need, maybe I can contribute finished container + refined Dockerfile + docker-related README and submit a pr😊😊

I'm now a student, so ignore me if I made something stupid.😂😂

# Dockerfile

# Based on the latest Ubuntu image
FROM ubuntu:latest

# Set default user to root
USER root

# Set non-interactive mode
ENV DEBIAN_FRONTEND=noninteractive

# Change system sources and install utilities and Python3
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources && \
    sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/ubuntu.sources && \
    apt update && apt upgrade -y && \
    apt install -y gcc wget unzip python3 python3-venv

# Install OpenJDK 21 and configure JAVA_HOME
RUN apt update && apt upgrade -y && apt install -y openjdk-21-jdk --fix-missing
ENV JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
ENV PATH="$JAVA_HOME/bin:$PATH"

# Create directory /softwares and change to it
WORKDIR /softwares

# Download and extract latest version of Ghidra
RUN wget https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.2.1_build/ghidra_11.2.1_PUBLIC_20241105.zip && \
    unzip ghidra_11.2.1_PUBLIC_20241105.zip && \
    rm ghidra_11.2.1_PUBLIC_20241105.zip

# Set Ghidra extraction directory path
ENV GHIDRA_INSTALL_DIR=/softwares/ghidra_11.2.1_PUBLIC

# Download and extract Ghidrathon
RUN mkdir /softwares/Ghidrathon && \
    wget https://github.com/mandiant/Ghidrathon/releases/download/v4.0.0/Ghidrathon-v4.0.0.zip && \
    unzip Ghidrathon-v4.0.0.zip -d /softwares/Ghidrathon && \
    rm Ghidrathon-v4.0.0.zip

# Change to Ghidrathon extraction directory
WORKDIR /softwares/Ghidrathon

# ! Add some dependencies (not best practice)
# TODO: fix this
RUN apt-get install -y python3-dev python-is-python3

# Create Python virtual environment and install dependencies
RUN python3 -m venv . && \
    ./bin/python -m pip install --upgrade pip && \
    ./bin/pip install numpy && \
    ./bin/python -m pip install -r requirements.txt

# Configure Ghidrathon with Ghidra
RUN ./bin/python ghidrathon_configure.py $GHIDRA_INSTALL_DIR && \
    unzip Ghidrathon-v4.0.0.zip -d $GHIDRA_INSTALL_DIR/Ghidra/Extensions

# Add Ghidra headless path to PATH
ENV PATH="$PATH:$GHIDRA_INSTALL_DIR/support"

# Set default working directory to /softwares
WORKDIR /softwares

# Default to start bash
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant