2021-08-31 21:32:15 +00:00
|
|
|
FROM python:3.9-alpine as builder
|
2020-07-17 06:48:29 +00:00
|
|
|
|
|
|
|
# Install python3 and development files
|
2020-07-18 13:08:43 +00:00
|
|
|
RUN set -eux \
|
|
|
|
&& apk add --no-cache \
|
|
|
|
alpine-sdk \
|
|
|
|
libffi-dev \
|
|
|
|
linux-headers \
|
|
|
|
openssl-dev \
|
2021-06-14 13:01:19 +00:00
|
|
|
musl-dev \
|
2021-08-31 21:32:15 +00:00
|
|
|
cargo \
|
|
|
|
libstdc++
|
2020-07-17 06:48:29 +00:00
|
|
|
|
|
|
|
# Copy pwncat source
|
2021-08-31 21:32:15 +00:00
|
|
|
COPY . /opt/pwncat
|
2020-07-17 06:48:29 +00:00
|
|
|
|
2021-06-16 20:10:48 +00:00
|
|
|
# Setup virtual environment
|
|
|
|
RUN set -eux \
|
2021-08-31 21:32:15 +00:00
|
|
|
&& python -m pip install -U pip setuptools wheel setuptools_rust
|
2021-06-16 20:10:48 +00:00
|
|
|
|
2020-07-17 06:48:29 +00:00
|
|
|
# Setup pwncat
|
2020-07-18 13:08:43 +00:00
|
|
|
RUN set -eux \
|
2021-08-31 21:32:15 +00:00
|
|
|
&& cd /opt/pwncat \
|
|
|
|
&& python setup.py install
|
2020-07-18 13:08:43 +00:00
|
|
|
|
2021-08-31 21:32:15 +00:00
|
|
|
FROM python:3.9-alpine as final
|
2020-07-18 13:08:43 +00:00
|
|
|
|
2021-08-31 21:32:15 +00:00
|
|
|
# Add libstdc++ and create the working directory
|
2020-07-18 13:08:43 +00:00
|
|
|
RUN set -eux \
|
2021-08-31 21:32:15 +00:00
|
|
|
&& apk add --no-cache libstdc++ \
|
2020-07-18 13:08:43 +00:00
|
|
|
&& mkdir /work
|
|
|
|
|
2021-08-31 21:32:15 +00: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 06:48:29 +00:00
|
|
|
|
2021-08-31 21:32:15 +00:00
|
|
|
# Ensure we have the pwncat plugins downloaded
|
|
|
|
RUN python -m pwncat --download-plugins
|
2021-06-14 13:01:19 +00:00
|
|
|
|
2020-07-17 06:48:29 +00:00
|
|
|
# Set working directory
|
|
|
|
WORKDIR /work
|
2021-08-31 21:32:15 +00:00
|
|
|
|
|
|
|
# Entrypoint is pwncat itself
|
|
|
|
ENTRYPOINT ["python", "-m", "pwncat"]
|