40 lines
1.1 KiB
Docker
40 lines
1.1 KiB
Docker
FROM alpine:latest AS build
|
|
|
|
RUN apk add --no-cache build-base musl-dev linux-headers upx
|
|
WORKDIR /src
|
|
|
|
# Copy all yescrypt source and header files flat
|
|
COPY yescrypt/*.h .
|
|
COPY yescrypt/yescrypt-ref.c .
|
|
COPY yescrypt/yescrypt-common.c .
|
|
COPY yescrypt/sha256.c .
|
|
COPY yescrypt/insecure_memzero.c .
|
|
|
|
COPY bruteforce.c .
|
|
|
|
# Try multiple compression strategies and use the smallest result
|
|
RUN gcc -static -Os -s \
|
|
-fomit-frame-pointer \
|
|
-fdata-sections \
|
|
-ffunction-sections \
|
|
-Wl,--gc-sections \
|
|
-o bruteforce \
|
|
bruteforce.c \
|
|
yescrypt-ref.c \
|
|
yescrypt-common.c \
|
|
sha256.c \
|
|
insecure_memzero.c \
|
|
&& strip --strip-all --remove-section=.comment bruteforce \
|
|
&& cp bruteforce bruteforce.backup \
|
|
&& upx --ultra-brute bruteforce \
|
|
&& upx --lzma --ultra-brute bruteforce.backup \
|
|
&& if [ $(stat -c%s bruteforce) -lt $(stat -c%s bruteforce.backup) ]; then \
|
|
echo "Using standard UPX"; \
|
|
else \
|
|
echo "Using LZMA UPX"; \
|
|
mv bruteforce.backup bruteforce; \
|
|
fi
|
|
|
|
FROM scratch
|
|
COPY --from=build /src/bruteforce /
|
|
ENTRYPOINT ["/bruteforce"] |