From 1e16927bef5d5de4d07d45405673643db920b687 Mon Sep 17 00:00:00 2001 From: agent-polyblank Date: Wed, 29 Jan 2025 16:11:07 +0000 Subject: [PATCH 1/3] added dockerfile and instructions on running from docker --- Dockerfile | 16 ++++++++++++++++ README.md | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..673439a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ghcr.io/astral-sh/uv:debian-slim +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +RUN apt-get update && apt-get install -y python3-pyelftools python3-requests git cmake ninja-build \ + build-essential pkg-config libicu-dev libcapstone-dev + +# Add the Debian testing repository to get GCC 13 +RUN echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list +RUN apt-get update && apt-get install -y gcc-13 g++-13 + +# Set GCC 13 as the default compiler +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-13 + +COPY . /app +WORKDIR /app \ No newline at end of file diff --git a/README.md b/README.md index 660ef4c..9c07e22 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,23 @@ brew install llvm@16 cmake ninja pkg-config icu4c capstone pip3 install pyelftools requests ``` +### Docker + +You can also run Blutter from docker. First build the docker image. + +```sh +docker build -t blutter . +``` + +Then you can run it as follows: + +```sh +docker run -v /path/to/app/lib/arm64-v8a:/arm64-v8a -v /path/to/outdir:/app/outdir blutter /arm64-v8a /outdir +``` +Where the first volume is the path to the lib directory of the apk and the second volume is the path to the output directory. + +This volume mounts the lib directory of the apk to the `/arm64-v8a` directory in the container and the output directory to the `/app/outdir` directory in the container. + ## Usage Extract "lib" directory from apk file ``` From 0d164f2c7d8a707de2d02110631343a8fe4b227e Mon Sep 17 00:00:00 2001 From: agent-polyblank Date: Wed, 29 Jan 2025 16:12:44 +0000 Subject: [PATCH 2/3] added dockerfile and instructions on running from docker --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c07e22..529db35 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ docker build -t blutter . Then you can run it as follows: ```sh -docker run -v /path/to/app/lib/arm64-v8a:/arm64-v8a -v /path/to/outdir:/app/outdir blutter /arm64-v8a /outdir +docker run -v /path/to/app/lib/arm64-v8a:/arm64-v8a -v /path/to/outdir:/app/outdir -t blutter:latest python3 blutter.py /arm64-v8a /outdir ``` Where the first volume is the path to the lib directory of the apk and the second volume is the path to the output directory. From 9be589b1803a59ac407fedb7ef7cb0b157311510 Mon Sep 17 00:00:00 2001 From: agent-polyblank Date: Mon, 3 Feb 2025 22:11:15 +0000 Subject: [PATCH 3/3] tidied up and optimised dockerfile --- Dockerfile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 673439a..1ce248e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,21 @@ -FROM ghcr.io/astral-sh/uv:debian-slim -COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ - -RUN apt-get update && apt-get install -y python3-pyelftools python3-requests git cmake ninja-build \ - build-essential pkg-config libicu-dev libcapstone-dev +FROM ghcr.io/astral-sh/uv:python3.12-bookworm # Add the Debian testing repository to get GCC 13 -RUN echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list -RUN apt-get update && apt-get install -y gcc-13 g++-13 - -# Set GCC 13 as the default compiler -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 \ +RUN echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y gcc-13 \ + g++-13 \ + git \ + cmake \ + ninja-build \ + build-essential \ + pkg-config \ + libicu-dev \ + libcapstone-dev && \ + apt-get clean && \ + uv pip install --system pyelftools requests && \ + # Set GCC 13 as the default compiler + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 \ --slave /usr/bin/g++ g++ /usr/bin/g++-13 COPY . /app