Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7bb2b63

Browse files
Merge contributions from VoltageX (thank you!) adding ngrep, OpenSSH and bug fixes
1 parent 29d0141 commit 7bb2b63

File tree

8 files changed

+81
-12
lines changed

8 files changed

+81
-12
lines changed

‎Dockerfile.git-2.33.0

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ COPY --from=expat /output /output
1111
COPY --from=openssl /output /output
1212
COPY --from=curl /output /output
1313

14-
# Avoid generating translations by dummying out msgfmt, also makes dependency on gettext optional
1514
WORKDIR /build
1615
RUN download https://github.com/git/git/archive/refs/tags/v2.33.0.tar.gz source.tar.gz ac8bb4bd4f689ddacd1f17c13e519c78d0f38ffc7c41dc24a4dbeb576bc88e91 && tar xf source.tar.gz
1716
RUN export PATH=/build/cross/bin:/output/bin:$PATH && \
@@ -25,7 +24,14 @@ make configure && \
2524
./configure \
2625
--without-tcltk \
2726
--host=$($MUSL_TARGET-gcc -dumpmachine) \
28-
--prefix=/output && \
27+
--target=$($MUSL_TARGET-gcc -dumpmachine) \
28+
--prefix=/output \
29+
# https://public-inbox.org/git/20190211214306.GB14229@alpha/
30+
# https://git.exherbo.org/arbor.git/tree/packages/dev-scm/git/git-build.exlib#n161
31+
# https://patch-diff.githubusercontent.com/raw/void-linux/void-packages/pull/18139.patch
32+
# https://marc.info/?l=git&m=120473229209965
33+
ac_cv_iconv_omits_bom=yes ac_cv_fread_reads_directories=no ac_cv_snprintf_returns_bogus=no && \
34+
# Avoid generating translations by dummying out msgfmt, also makes dependency on gettext optional
2935
echo "#!/bin/sh\nexit 0" > /usr/local/bin/msgfmt && \
3036
chmod +x /usr/local/bin/msgfmt && \
3137
make -j$(nproc) && \

‎Dockerfile.musl-cross-make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sed -e 's/http:\/\/[^/]*/http:\/\/deb.debian.org/g' -i /etc/apt/sources.list &&
1010
apt-get --option=Dpkg::Options::=--force-unsafe-io update && \
1111
apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io -y dist-upgrade && \
1212
apt-get --option=Dpkg::Options::=--force-unsafe-io -y autoremove && \
13-
apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io install -y --no-install-recommends build-essential ca-certificates wget unzip flex bison autoconf file python3 && \
13+
apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::Options::=--force-unsafe-io install -y --no-install-recommends build-essential ca-certificates wget unzip flex bison autoconf file python3 cmake && \
1414
apt-get clean
1515
RUN download https://github.com/richfelker/musl-cross-make/archive/refs/tags/v0.9.9.zip /tmp/musl-cross-make.zip 6cbe2f6ce92e7f8f3973786aaf0b990d0db380c0e0fc419a7d516df5bb03c891 && \
1616
mkdir /build && \

‎Dockerfile.ngrep-2a9603b

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG MUSL_TARGET=x86_64-linux-musl
2+
FROM libpcap-1.10.1-${MUSL_TARGET} AS libpcap
3+
FROM musl-cross-make-${MUSL_TARGET}
4+
ARG MUSL_TARGET
5+
6+
COPY --from=libpcap /output /output
7+
8+
WORKDIR /build
9+
RUN download https://github.com/jpr5/ngrep/archive/2a9603bc67dface9606a658da45e1f5c65170444.tar.gz source.tar.gz 500c29914dd26f5aa6df07446388d49b60249622c9b0fd1f266f62a5706f056c && tar xf source.tar.gz
10+
RUN export PATH=/build/cross/bin:$PATH && \
11+
cd ngrep-* && \
12+
CC="${MUSL_TARGET}-gcc -static" \
13+
CXX="${MUSL_TARGET}-g++ -static -static-libstdc++" \
14+
CFLAGS="-frandom-seed=pulse -I/output/include" \
15+
LDFLAGS="-L/output/lib" \
16+
./configure \
17+
--enable-ipv6 \
18+
--prefix=/output \
19+
--host=$($MUSL_TARGET-gcc -dumpmachine) && \
20+
make -j$(nproc) && \
21+
make install && \
22+
$MUSL_TARGET-strip /output/bin/ngrep
23+
24+
CMD bash

‎Dockerfile.openssh-8.8p1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG MUSL_TARGET=x86_64-linux-musl
2+
FROM zlib-1.2.11-${MUSL_TARGET} AS zlib
3+
FROM openssl-1.1.1k-${MUSL_TARGET} AS openssl
4+
FROM musl-cross-make-${MUSL_TARGET}
5+
ARG MUSL_TARGET
6+
7+
COPY --from=zlib /output /output
8+
COPY --from=openssl /output /output
9+
10+
RUN download https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.8p1.tar.gz source.tar.gz 4590890ea9bb9ace4f71ae331785a3a5823232435161960ed5fc86588f331fe9 && tar xf source.tar.gz
11+
RUN export PATH=/build/cross/bin:/output/bin:$PATH && \
12+
cd openssh-* && \
13+
export CC="$MUSL_TARGET-gcc" && \
14+
export CFLAGS="-static -frandom-seed=pulse -I/output/include" && \
15+
export CPPFLAGS=$CFLAGS && \
16+
export LDFLAGS="-L/output/lib" && \
17+
./configure --host=$($CC -dumpmachine) --with-zlib=/output --prefix=/output --with-pie --with-ldflags=-static --disable-strip && \
18+
make -j$(nproc) && \
19+
make install-files && \
20+
$MUSL_TARGET-strip /output/bin/ssh && \
21+
$MUSL_TARGET-strip /output/bin/scp && \
22+
$MUSL_TARGET-strip /output/bin/sftp && \
23+
$MUSL_TARGET-strip /output/bin/ssh-keygen

‎Dockerfile.pcre-8.45

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM musl-cross-make-$MUSL_TARGET
33
ARG MUSL_TARGET
44

55
WORKDIR /build
6-
RUN download https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.gz source.tar.gz 4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09 && tar xf source.tar.gz
6+
RUN download https://ftp.exim.org/pub/pcre/pcre-8.45.tar.gz source.tar.gz 4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09 && tar xf source.tar.gz
77
RUN export PATH=/build/cross/bin:$PATH && \
88
cd pcre-* && \
99
CC="$MUSL_TARGET-gcc" \

‎Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ UNAME_M := $(shell uname -m)
44
DOCKER_BUILD = docker build --build-arg MUSL_TARGET=$(MUSL_TARGET) -f Dockerfile.$@ -t $@-$(MUSL_TARGET) .
55
GRABBY_HANDS = docker run --rm --mount type=bind,source=$(shell pwd)/output/$(MUSL_TARGET),target=/grabby $@-$(MUSL_TARGET) install -g $(shell id -g) -o $(shell id -u)
66

7-
all: busybox-1.33.1 curl-7.79.1 dropbear-2020.81 loggedfs-0.9 nmap-7.90 openssl-1.1.1k socat-1.7.4.1 tcpdump-4.99.1
7+
all: busybox-1.33.1 curl-7.79.1 dropbear-2020.81 loggedfs-0.9 ngrep-2a9603b nmap-7.90 openssl-1.1.1k parted-3.4 socat-1.7.4.1 tcpdump-4.99.1
88

99
check:
1010
@echo "These binaries are not built properly:"
@@ -86,6 +86,10 @@ nmap-7.90: openssl-1.1.1k libpcap-1.10.1 zlib-1.2.11 pcre-8.45
8686
$(DOCKER_BUILD)
8787
$(GRABBY_HANDS) /output/bin/nmap /grabby/$@
8888

89+
ngrep-2a9603b: libpcap-1.10.1 pcre-8.45
90+
$(DOCKER_BUILD)
91+
$(GRABBY_HANDS) /output/bin/ngrep /grabby/$@
92+
8993
tcpdump-4.99.1: libpcap-1.10.1
9094
$(DOCKER_BUILD)
9195
$(GRABBY_HANDS) /output/bin/tcpdump /grabby/$@
@@ -103,14 +107,17 @@ nsjail-3.0: libnl-3.2.25 protobuf-3.19.1
103107
$(DOCKER_BUILD)
104108
$(GRABBY_HANDS) /build/nsjail-3.0/nsjail /grabby/$@
105109

106-
parted-3.4: e2fsprogs-1.46.5 readline-8.1
107-
$(DOCKER_BUILD)
108-
$(GRABBY_HANDS) /output/sbin/parted /grabby/$@
109-
110110
# By default just build the basic 'git' binary. If you want "everything" then set GIT_FULL as an environment variable. The 'git-versionnumber' binary will need to be renamed to just 'git' to work.
111111
git-2.33.0: expat-2.4.1 openssl-1.1.1k curl-7.79.1 zlib-1.2.11
112112
$(DOCKER_BUILD)
113-
$(GRABBY_HANDS) /output/bin/git /grabby/$@
113+
#$(GRABBY_HANDS) /output/bin/git /grabby/$@
114114
ifdef GIT_FULL
115115
$(GRABBY_HANDS) /output/full.tar.gz /grabby/$@.tar.gz
116116
endif
117+
118+
openssh-8.8p1: musl-cross-make zlib-1.2.11 openssl-1.1.1k
119+
$(DOCKER_BUILD)
120+
$(GRABBY_HANDS) /output/bin/ssh /grabby/ssh-8.8p1
121+
$(GRABBY_HANDS) /output/bin/scp /grabby/scp-8.8p1
122+
$(GRABBY_HANDS) /output/bin/sftp /grabby/sftp-8.8p1
123+
$(GRABBY_HANDS) /output/bin/ssh-keygen /grabby/ssh-keygen-8.8p1

‎README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# static-binary-zoo
22

3-
A set of Dockerfiles to statically cross-compile various "hacker tools" using [musl-cross-make](https://github.com/richfelker/musl-cross-make). This is a work in progress, and I'll be adding recipes and further documentation over time.
3+
A set of Dockerfiles to statically cross-compile various "hacker tools" using [musl-cross-make](https://github.com/richfelker/musl-cross-make). This is a work in progress, and more tools and libraries will be added over time.
44

55
## Usage
66

@@ -27,7 +27,9 @@ These are the tools that build cleanly without too many caveats and are generall
2727
* `curl-7.79.1`
2828
* `dropbear-2020.81` (`dropbear`, `dropbearclient` and `dropbearkey`)
2929
* `loggedfs-0.9`
30+
* `ngrep-2a9603b`
3031
* `nmap-7.90` (some extra functionality is missing as it requires additional data files)
32+
* `openssh-8.8p1` (`ssh`, `scp`, `sftp` and `ssh-keygen`)
3133
* `openssl-0.9.8zh` (insecure, not for general use)
3234
* `openssl-1.1.1k`
3335
* `parted-3.4`
@@ -79,6 +81,13 @@ And yet to be added:
7981

8082
* Update notification feature (this may involve switching package sources to come from Debian).
8183

84+
## Contributors
85+
86+
These people have contributed code and fixes:
87+
88+
* Adam Baxter (@voltagex)
89+
* Michael Fincham (https://finch.am/)
90+
8291
## Feedback? Questions?
8392

8493
E-mail michael@hotplate.co.nz. I'd love to receive your improvements. No, I don't really know how to use Docker.

‎download

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if __name__ == "__main__":
3939
os.link(f.name, args.destination)
4040
else:
4141
sys.stderr.write(
42-
"error: checksum didn't match for '%s', not saving file. got %s and expected %s.\n"
42+
"\nerror: checksum didn't match for '%s', not saving file.\ngot %s and expected %s.\n"
4343
% (args.url, checksum.hexdigest(), sha256sum)
4444
)
4545
return_code = 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /