Skip to content

Add docker image for signature generation with sigem #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "$@"
Loading