2021-06-16 23:08:01 +02:00
|
|
|
FROM alpine:3.13.5 as builder
|
2020-07-17 08:48:29 +02:00
|
|
|
|
|
|
|
# Install python3 and development files
|
2020-07-18 15:08:43 +02:00
|
|
|
RUN set -eux \
|
|
|
|
&& apk add --no-cache \
|
|
|
|
alpine-sdk \
|
|
|
|
libffi-dev \
|
|
|
|
linux-headers \
|
|
|
|
openssl-dev \
|
|
|
|
python3 \
|
2021-06-14 15:01:19 +02:00
|
|
|
python3-dev \
|
|
|
|
musl-dev \
|
|
|
|
cargo
|
2020-07-17 08:48:29 +02:00
|
|
|
|
|
|
|
# Copy pwncat source
|
|
|
|
COPY . /pwncat
|
|
|
|
|
2021-06-16 22:10:48 +02:00
|
|
|
# Setup virtual environment
|
|
|
|
RUN set -eux \
|
|
|
|
&& python3 -m venv /opt/pwncat \
|
2021-06-16 23:08:01 +02:00
|
|
|
&& /opt/pwncat/bin/python -m ensurepip \
|
|
|
|
&& /opt/pwncat/bin/python -m pip install -U pip setuptools wheel setuptools_rust
|
2021-06-16 22:10:48 +02:00
|
|
|
|
2020-07-17 08:48:29 +02:00
|
|
|
# Setup pwncat
|
2020-07-18 15:08:43 +02:00
|
|
|
RUN set -eux \
|
|
|
|
&& cd /pwncat \
|
2021-06-16 22:10:48 +02:00
|
|
|
&& /opt/pwncat/bin/python setup.py install
|
2020-07-18 15:08:43 +02:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
RUN set -eux \
|
2021-06-16 22:10:48 +02:00
|
|
|
&& find /opt/pwncat/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \
|
|
|
|
&& find /opt/pwncat/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true
|
2020-07-18 15:08:43 +02:00
|
|
|
|
|
|
|
|
2021-06-16 23:08:01 +02:00
|
|
|
FROM alpine:3.13.5 as final
|
2020-07-18 15:08:43 +02:00
|
|
|
|
|
|
|
RUN set -eux \
|
|
|
|
&& apk add --no-cache \
|
2021-02-08 23:13:08 +01:00
|
|
|
python3 libstdc++ \
|
2020-07-18 15:08:43 +02:00
|
|
|
&& find /usr/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \
|
|
|
|
&& find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true \
|
|
|
|
&& mkdir /work
|
|
|
|
|
2021-06-16 22:10:48 +02:00
|
|
|
COPY --from=builder /opt/pwncat /opt/pwncat
|
2020-07-17 08:48:29 +02:00
|
|
|
|
2021-06-16 22:10:48 +02:00
|
|
|
RUN /opt/pwncat/bin/python -m pwncat --download-plugins
|
2021-06-14 15:01:19 +02:00
|
|
|
|
2020-07-17 08:48:29 +02:00
|
|
|
# Set working directory
|
|
|
|
WORKDIR /work
|
2021-06-16 22:10:48 +02:00
|
|
|
ENTRYPOINT ["/opt/pwncat/bin/pwncat"]
|