Skip to content

Commit

Permalink
Add docker image for signature generation with sigem
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Nov 14, 2024
1 parent bae7379 commit ab3b013
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Cargo.lock
# Best practice for something like this, the python scripts are not meant to be "deployed" from this repo state.
poetry.lock

binaryninja/
*.dat

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
21 changes: 21 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM rust:1.77 AS builder
# The binaryninja-api commit to use, remember sigem is pulled from here.
ARG COMMIT=30a0fbb5839b08dc58efe602a5cd19c90fbd4c50
# Copy the binja install. This won't be included in the final image.
COPY ./binaryninja /binaryninja
ENV BINARYNINJADIR=/binaryninja
# Clone the binaryninja-api repo where `sigem` lives.
RUN apt-get update && apt-get install -y git libclang-dev
RUN git clone https://github.com/Vector35/binaryninja-api /binaryninja-api \
&& cd /binaryninja-api \
&& git checkout $COMMIT
# Install sigem
RUN cargo install --path /binaryninja-api/plugins/warp/ --bin sigem

FROM ubuntu:24.10 AS runner
# Copy sigem binary over
COPY --from=builder /usr/local/cargo/bin/sigem /usr/local/bin/sigem
# Copy in the entrypoint (what sets up the environment)
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
18 changes: 18 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
sigem:
build:
context: .
dockerfile: Dockerfile
environment:
BN_LICENSE_FILE: /run/secrets/license
volumes:
- ./binaryninja:/binaryninja:ro
- ./signatures:/signatures
- ./data:/data:ro
secrets:
- license
command: [ "/data/a.out", "/signatures/a" ]

secrets:
license:
file: license.dat
6 changes: 6 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -Eeuo pipefail

mkdir -p ~/.binaryninja
cp "$BN_LICENSE_FILE" ~/.binaryninja/license.dat
exec sigem "$@"

0 comments on commit ab3b013

Please sign in to comment.