2021-08-31 23:32:15 +02:00
|
|
|
FROM python:3.9-alpine 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 \
|
2021-06-14 15:01:19 +02:00
|
|
|
musl-dev \
|
2021-08-31 23:32:15 +02:00
|
|
|
cargo \
|
|
|
|
libstdc++
|
2020-07-17 08:48:29 +02:00
|
|
|
|
|
|
|
# Copy pwncat source
|
2021-08-31 23:32:15 +02:00
|
|
|
COPY . /opt/pwncat
|
2020-07-17 08:48:29 +02:00
|
|
|
|
2021-06-16 22:10:48 +02:00
|
|
|
# Setup virtual environment
|
|
|
|
RUN set -eux \
|
2021-08-31 23:32:15 +02:00
|
|
|
&& 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 \
|
2021-08-31 23:32:15 +02:00
|
|
|
&& cd /opt/pwncat \
|
|
|
|
&& python setup.py install
|
2020-07-18 15:08:43 +02:00
|
|
|
|
2021-08-31 23:32:15 +02:00
|
|
|
FROM python:3.9-alpine as final
|
2020-07-18 15:08:43 +02:00
|
|
|
|
2021-08-31 23:32:15 +02:00
|
|
|
# Add libstdc++ and create the working directory
|
2020-07-18 15:08:43 +02:00
|
|
|
RUN set -eux \
|
2021-08-31 23:32:15 +02:00
|
|
|
&& apk add --no-cache libstdc++ \
|
2020-07-18 15:08:43 +02:00
|
|
|
&& mkdir /work
|
|
|
|
|
2021-08-31 23:32:15 +02:00
|
|
|
# Copy installed packages from builder image
|
|
|
|
COPY --from=builder /usr/local/lib/python3.9 /usr/local/lib/python3.9
|
|
|
|
COPY --from=builder /usr/local/bin/pwncat /usr/local/bin/pwncat
|
2020-07-17 08:48:29 +02:00
|
|
|
|
2021-08-31 23:32:15 +02:00
|
|
|
# Ensure we have the pwncat plugins downloaded
|
|
|
|
RUN 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-08-31 23:32:15 +02:00
|
|
|
|
|
|
|
# Entrypoint is pwncat itself
|
|
|
|
ENTRYPOINT ["python", "-m", "pwncat"]
|