Skip to content

Commit

Permalink
all Docker envs: add support for connection to host device
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Dec 18, 2024
1 parent 9c4e821 commit f097058
Show file tree
Hide file tree
Showing 73 changed files with 307 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...

## [unreleased][unreleased]
- Added support for connection to host device in all Docker envs (@doegox)
- Changed `hf 15 info` to show all type matches and check ST25TVxC signature (@doegox)
- Added initial support for ST25TN and its signature verification (@doegox)
- Changed originality checks handling to refactor code and pk data (@doegox)
Expand Down
4 changes: 4 additions & 0 deletions docker/archlinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ RUN pacman -S --noconfirm ocl-icd
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/archlinux/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-arch:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/archlinux/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-arch:1.0
5 changes: 3 additions & 2 deletions docker/archlinux/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-arch:1.0)
docker image rm pm3-arch:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/archlinux/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-arch:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
4 changes: 4 additions & 0 deletions docker/debian-11-bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ RUN apt-get install -y opencl-dev && \
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/debian-11-bullseye/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-debian-bullseye:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/debian-11-bullseye/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-debian-bullseye:1.0
5 changes: 3 additions & 2 deletions docker/debian-11-bullseye/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-debian-bullseye:1.0)
docker image rm pm3-debian-bullseye:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/debian-11-bullseye/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-debian-bullseye:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
4 changes: 4 additions & 0 deletions docker/debian-12-bookworm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ RUN apt-get install -y opencl-dev && \
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/debian-12-bookworm/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-debian-bookworm:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/debian-12-bookworm/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-debian-bookworm:1.0
5 changes: 3 additions & 2 deletions docker/debian-12-bookworm/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-debian-bookworm:1.0)
docker image rm pm3-debian-bookworm:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/debian-12-bookworm/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-debian-bookworm:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
4 changes: 4 additions & 0 deletions docker/debian-13-trixie/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ RUN apt-get install -y opencl-dev && \
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/debian-13-trixie/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-debian-trixie:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/debian-13-trixie/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-debian-trixie:1.0
5 changes: 3 additions & 2 deletions docker/debian-13-trixie/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-debian-trixie:1.0)
docker image rm pm3-debian-trixie:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/debian-13-trixie/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-debian-trixie:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
4 changes: 4 additions & 0 deletions docker/fedora-36/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ RUN yum -y install mesa-libOpenCL ocl-icd-devel
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/fedora-36/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-fedora-36:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/fedora-36/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-fedora-36:1.0
5 changes: 3 additions & 2 deletions docker/fedora-36/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-fedora-36:1.0)
docker image rm pm3-fedora-36:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/fedora-36/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-fedora-36:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
4 changes: 4 additions & 0 deletions docker/fedora-37/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ RUN yum -y install mesa-libOpenCL ocl-icd-devel
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/fedora-37/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-fedora-37:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/fedora-37/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-fedora-37:1.0
5 changes: 3 additions & 2 deletions docker/fedora-37/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-fedora-37:1.0)
docker image rm pm3-fedora-37:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/fedora-37/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-fedora-37:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
5 changes: 5 additions & 0 deletions docker/homebrew/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ FROM homebrew/brew

ENV LANG=C

ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN sudo groupadd -g ${UART_GID} mydialout || true
RUN sudo usermod -aG ${UART_GID} linuxbrew

USER linuxbrew
WORKDIR "/home/linuxbrew"
RUN brew install cmake pkg-config bzip2 lz4 && rm -rf ~/.cache/Homebrew
Expand Down
7 changes: 4 additions & 3 deletions docker/homebrew/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ So only host bins can be built (except tools/hitag2crack/crack5opencl which need

```sh
make -j client USE_BREW=1 SKIPREADLINE=1
make -j mfkey
make -j nonce2key
make -j mf_nonce_brute
make -j cryptorf
make -j mfc_card_only
make -j mfc_card_reader
make -j mfd_aes_brute
make -j hitag2crack SKIPOPENCL=1
make -j fpga_compress
```
Expand Down
5 changes: 4 additions & 1 deletion docker/homebrew/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-brew:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/homebrew/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-brew:1.0
5 changes: 3 additions & 2 deletions docker/homebrew/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-brew:1.0)
docker image rm pm3-brew:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/homebrew/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/linuxbrew/proxmark3 -w /home/linuxbrew/proxmark3 -it pm3-brew:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
# if needed, run brew as user linuxbrew
10 changes: 6 additions & 4 deletions docker/kali/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev libgd-dev sudo && \
apt-get clean

RUN apt-get install -y python3-minimal && \
apt-get install -y python3-pip && \
apt-get clean && \
python3 -m pip install ansicolors sslcrypto
RUN apt-get install -y --no-install-recommends python3-minimal python3-pip python3-venv && \
apt-get clean

RUN apt-get install -y opencl-dev && \
apt-get clean

# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
5 changes: 4 additions & 1 deletion docker/kali/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

docker build -t "pm3-kali:1.0" .
. docker_conf
UART_PORT="$(../../pm3 --list|head -n1|cut -d' ' -f2)"
UART_GID="$(stat -c '%g' $UART_PORT)"
docker build --build-arg UART_GID="$UART_GID" -t "$DOCKER_IMAGE" .
2 changes: 2 additions & 0 deletions docker/kali/docker_conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sourceme
DOCKER_IMAGE=pm3-kali:1.0
5 changes: 3 additions & 2 deletions docker/kali/docker_rm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

docker rm $(docker ps -aq --filter ancestor=pm3-kali:1.0)
docker image rm pm3-kali:1.0
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"
9 changes: 8 additions & 1 deletion docker/kali/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-kali:1.0
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"
5 changes: 5 additions & 0 deletions docker/kali/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
# docker/kali/run_tests.sh;

sudo apt update && sudo apt upgrade -y
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3 -m pip install --use-pep517 pyaes
python3 -m pip install ansicolors sslcrypto
tools/release_tests.sh
deactivate
4 changes: 4 additions & 0 deletions docker/opensuse-leap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ RUN zypper --non-interactive install ocl-icd-devel
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN groupadd -g ${UART_GID} mydialout || true
RUN usermod -aG ${UART_GID} rrg
RUN printf 'rrg ALL=(ALL) NOPASSWD: ALL\n' | tee -a /etc/sudoers

USER rrg
Expand Down
Loading

0 comments on commit f097058

Please sign in to comment.