Skip to content

Instantly share code, notes, and snippets.

@Nuxij
Last active June 16, 2021 01:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Nuxij/b237bf57e60c5eeb60264c1df48a3470 to your computer and use it in GitHub Desktop.
Save Nuxij/b237bf57e60c5eeb60264c1df48a3470 to your computer and use it in GitHub Desktop.
[Docker] masscan on alpine
# Example:
# $ docker build -t masscan -f masscan.Dockerfile .
# $ docker run --rm -it --net=host masscan -p0-65535 192.168.0.0/16 --rate 1000000
# --net=host is optional but I saw rate limit without it
# -v $(pwd):/opt if you want to feed result files back out
FROM alpine as builder
LABEL author "Peng Liu"
LABEL email "myme5261314@gmail.com"
ARG MASSCAN_GIT_URL=https://github.com/robertdavidgraham/masscan
RUN set -ex; \
apk --update add --no-cache \
ca-certificates \
clang \
clang-dev \
gcc \
git \
libc-dev \
linux-headers \
make \
libpcap-dev && \
git clone "$MASSCAN_GIT_URL"; \
cd masscan && \
make -j4 && \
cp bin/masscan /usr/local/bin/ && \
cd .. && \
rm -rf masscan
FROM alpine
LABEL author "Joe Eaves"
LABEL email "joe.eaves@shadowacre.ltd"
RUN apk --update add --no-cache libpcap-dev
COPY --from=builder /usr/local/bin/masscan /usr/local/bin/masscan
ENTRYPOINT ["/usr/local/bin/masscan"]
WORKDIR /opt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment