diff --git a/.forgejo/workflows/build-gdb.yml b/.forgejo/workflows/build-gdb.yml new file mode 100644 index 0000000..710af0d --- /dev/null +++ b/.forgejo/workflows/build-gdb.yml @@ -0,0 +1,165 @@ +name: GDB & gdbserver +on: + workflow_dispatch +jobs: + + build-x86: + name: Build GDB & gdbserver x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.build_gdb.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install build compiler + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh x86_64 + + - name: Install dependencies workaround + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh i686 + + - name: Build GDB + id: build_gdb + run: | + export PATH="$PATH:/i686-linux-musl-cross/bin" + $GITHUB_WORKSPACE/build/targets/build_gdb.sh x86 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_gdb.outputs.PACKAGED_NAME }} + path: ${{ steps.build_gdb.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build GDB & gdbserver x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install build compiler + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh x86_64 + + - name: Build GDB + id: build_gdb + run: | + $GITHUB_WORKSPACE/build/targets/build_gdb.sh x86_64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_gdb.outputs.PACKAGED_NAME }} + path: ${{ steps.build_gdb.outputs.PACKAGED_NAME_PATH }} + + + build-armhf: + name: Build GDB & gdbserver ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install build compiler + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh x86_64 + + - name: Install dependencies workaround + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh arm + + - name: Build gdb + id: build_gdb + run: | + export PATH="$PATH:/arm-linux-musleabihf-cross/bin" + $GITHUB_WORKSPACE/build/targets/build_gdb.sh armhf + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_gdb.outputs.PACKAGED_NAME }} + path: ${{ steps.build_gdb.outputs.PACKAGED_NAME_PATH }} + + + build-aarch64: + name: Build GDB & gdbserver AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install build compiler + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh x86_64 + + - name: Install dependencies workaround + run: $GITHUB_WORKSPACE/build/02_install_build_compiler.sh aarch64 + + - name: Patch headers + run: | + patch /aarch64-linux-musl-cross/aarch64-linux-musl/include/asm/sigcontext.h < $GITHUB_WORKSPACE/patches/gdb/gdb-aarch64-header-sigcontext-fix.patch + + - name: Build GDB + id: build_gdb + run: | + export PATH="$PATH:/aarch64-linux-musl-cross/bin" + $GITHUB_WORKSPACE/build/targets/build_gdb.sh aarch64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_gdb.outputs.PACKAGED_NAME }} + path: ${{ steps.build_gdb.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create GDB & gdbserver Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + if git rev-list "gdb-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for gdb-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo ::set-output name=NEW_RELEASE::"false" + else + git tag "gdb-v${{ needs.build-x86.outputs.version }}" + git push origin "gdb-v${{ needs.build-x86.outputs.version }}" + echo ::set-output name=NEW_RELEASE::"true" + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: gdb-v${{ needs.build-x86.outputs.version }} + tag: gdb-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.forgejo/workflows/build-nmap.yml b/.forgejo/workflows/build-nmap.yml new file mode 100644 index 0000000..33f0d3d --- /dev/null +++ b/.forgejo/workflows/build-nmap.yml @@ -0,0 +1,169 @@ +name: Nmap +on: + workflow_dispatch +jobs: + + build-x86: + name: Build Nmap x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.package_nmap.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build Nmap + run: $GITHUB_WORKSPACE/build/targets/build_nmap.sh x86 + + - name: Package Nmap + id: package_nmap + run: $GITHUB_WORKSPACE/package/targets/nmap/package.sh /output x86 + + - name: Upload tarball + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL }} + path: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL_PATH }} + + - name: Upload zip + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_ZIP }} + path: ${{ steps.package_nmap.outputs.PACKAGED_ZIP_PATH }} + + build-x86_64: + name: Build Nmap x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build Nmap + run: $GITHUB_WORKSPACE/build/targets/build_nmap.sh x86_64 + + - name: Package Nmap + id: package_nmap + run: $GITHUB_WORKSPACE/package/targets/nmap/package.sh /output x86_64 + + - name: Upload tarball + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL }} + path: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL_PATH }} + + - name: Upload zip + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_ZIP }} + path: ${{ steps.package_nmap.outputs.PACKAGED_ZIP_PATH }} + + build-armhf: + name: Build Nmap ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build Nmap + run: $GITHUB_WORKSPACE/build/targets/build_nmap.sh armhf + + - name: Package Nmap + id: package_nmap + run: $GITHUB_WORKSPACE/package/targets/nmap/package.sh /output armhf + + - name: Upload tarball + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL }} + path: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL_PATH }} + + - name: Upload zip + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_ZIP }} + path: ${{ steps.package_nmap.outputs.PACKAGED_ZIP_PATH }} + + build-aarch64: + name: Build Nmap AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build Nmap + run: $GITHUB_WORKSPACE/build/targets/build_nmap.sh aarch64 + + - name: Package Nmap + id: package_nmap + run: $GITHUB_WORKSPACE/package/targets/nmap/package.sh /output aarch64 + + - name: Upload tarball + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL }} + path: ${{ steps.package_nmap.outputs.PACKAGED_TARBALL_PATH }} + + - name: Upload zip + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package_nmap.outputs.PACKAGED_ZIP }} + path: ${{ steps.package_nmap.outputs.PACKAGED_ZIP_PATH }} + + create-release: + name: Create Nmap Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + git fetch --quiet --prune --tags + if [[ $(git tag -l | grep nmap-v${{ needs.build-x86.outputs.version }} | wc -l) -gt 0 ]]; then + echo "Tag for nmap-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + echo "Tag for nmap-v${{ needs.build-x86.outputs.version }} missing. Starting release creation." + git tag "nmap-v${{ needs.build-x86.outputs.version }}" + git push origin "nmap-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: Nmap v${{ needs.build-x86.outputs.version }} + tag: nmap-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.forgejo/workflows/build-openssh.yml b/.forgejo/workflows/build-openssh.yml new file mode 100644 index 0000000..de32095 --- /dev/null +++ b/.forgejo/workflows/build-openssh.yml @@ -0,0 +1,130 @@ +name: OpenSSH +on: + workflow_dispatch +jobs: + build-x86: + name: Build OpenSSH x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.build_openssh.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build OpenSSH + id: build_openssh + run: $GITHUB_WORKSPACE/build/targets/build_openssh.sh x86 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_openssh.outputs.PACKAGED_NAME }} + path: ${{ steps.build_openssh.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build OpenSSH x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build OpenSSH + id: build_openssh + run: $GITHUB_WORKSPACE/build/targets/build_openssh.sh x86_64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_openssh.outputs.PACKAGED_NAME }} + path: ${{ steps.build_openssh.outputs.PACKAGED_NAME_PATH }} + + build-armhf: + name: Build OpenSSH ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build OpenSSH + id: build_openssh + run: $GITHUB_WORKSPACE/build/targets/build_openssh.sh armhf + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_openssh.outputs.PACKAGED_NAME }} + path: ${{ steps.build_openssh.outputs.PACKAGED_NAME_PATH }} + + build-aarch64: + name: Build OpenSSH AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build OpenSSH + id: build_openssh + run: $GITHUB_WORKSPACE/build/targets/build_openssh.sh aarch64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_openssh.outputs.PACKAGED_NAME }} + path: ${{ steps.build_openssh.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create OpenSSH Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + if git rev-list "openssh-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for openssh-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + git tag "openssh-v${{ needs.build-x86.outputs.version }}" + git push origin "openssh-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: openssh-v${{ needs.build-x86.outputs.version }} + tag: openssh-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.forgejo/workflows/build-socat.yml b/.forgejo/workflows/build-socat.yml new file mode 100644 index 0000000..6113268 --- /dev/null +++ b/.forgejo/workflows/build-socat.yml @@ -0,0 +1,235 @@ +name: socat +on: + workflow_dispatch +jobs: + build-x86: + name: Build socat x86 + runs-on: docker + container: + image: muslcc/x86_64:i686-linux-musl + outputs: + version: "${{ steps.build_socat.outputs.PACKAGED_VERSION }}" + steps: + - name: Install dependencies + run: sudo apk update && sudo apk add bash nodejs git-lfs + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install build dependencies + run: sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh x86 + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build socat x86_64 + runs-on: docker + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Install dependencies + run: sudo apk update && sudo apk add bash nodejs git-lfs + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install build dependencies + run: sudo bash build/install_deps_alpine.sh + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh x86_64 + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-armhf: + name: Build socat ARMHF + runs-on: docker + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh armhf + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-aarch64: + name: Build socat AARCH64 + runs-on: docker + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh aarch64 + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-ppc32: + name: Build socat powerpc32 + runs-on: docker + container: muslcc/x86_64:powerpc-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh ppc32 + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-ppc64: + name: Build socat powerpc64 + runs-on: docker + container: muslcc/x86_64:powerpc64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh ppc64 + + - name: Upload artifacts + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create socat Release + runs-on: docker + needs: [build-x86, build-x86_64, build-armhf, build-aarch64, build-ppc32, build-ppc64] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: https://code.forgejo.org/forgejo/download-artifact@v4 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + if git rev-list "socat-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for socat-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + git tag "socat-v${{ needs.build-x86.outputs.version }}" + git push origin "socat-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: socat-v${{ needs.build-x86.outputs.version }} + tag: socat-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.forgejo/workflows/build-strace.yml b/.forgejo/workflows/build-strace.yml new file mode 100644 index 0000000..c5a426a --- /dev/null +++ b/.forgejo/workflows/build-strace.yml @@ -0,0 +1,166 @@ +name: strace +on: + workflow_dispatch +jobs: + build-x86: + name: Build strace x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.build_strace.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh x86 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build strace x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh x86_64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-armhf: + name: Build strace ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh armhf + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-aarch64: + name: Build strace AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh aarch64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create strace Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + if git rev-list "strace-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for strace-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + git tag "strace-v${{ needs.build-x86.outputs.version }}" + git push origin "strace-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: strace-v${{ needs.build-x86.outputs.version }} + tag: strace-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.forgejo/workflows/build-tcpdump.yml b/.forgejo/workflows/build-tcpdump.yml new file mode 100644 index 0000000..080857c --- /dev/null +++ b/.forgejo/workflows/build-tcpdump.yml @@ -0,0 +1,129 @@ +name: tcpdump +on: + workflow_dispatch +jobs: + build-x86: + name: Build tcpdump x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.build_tcpdump.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build tcpdump + id: build_tcpdump + run: $GITHUB_WORKSPACE/build/targets/build_tcpdump.sh x86 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME }} + path: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build tcpdump x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build tcpdump + id: build_tcpdump + run: $GITHUB_WORKSPACE/build/targets/build_tcpdump.sh x86_64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME }} + path: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME_PATH }} + + build-armhf: + name: Build tcpdump ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build tcpdump + id: build_tcpdump + run: $GITHUB_WORKSPACE/build/targets/build_tcpdump.sh armhf + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME }} + path: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME_PATH }} + + build-aarch64: + name: Build tcpdump AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Build tcpdump + id: build_tcpdump + run: $GITHUB_WORKSPACE/build/targets/build_tcpdump.sh aarch64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME }} + path: ${{ steps.build_tcpdump.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create tcpdump Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + run: | + set +e + if git rev-list "tcpdump-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for tcpdump-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + git tag "tcpdump-v${{ needs.build-x86.outputs.version }}" + git push origin "tcpdump-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: tcpdump-v${{ needs.build-x86.outputs.version }} + tag: tcpdump-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 5dac028..5772046 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,31 @@ # static-toolbox -This repository includes prebuild static binaries and build-recipes for various tools like Nmap. +This repository includes prebuild static binaries and build-recipes for various tools like Nmap and OpenSSH. -The Linux versions are compiled with the [musl-cross](https://github.com/takeshixx/musl-cross) toolchain and the [openssl-pm-snapshot](https://github.com/drwetter/openssl-pm-snapshot) fork of OpenSSL in order to support a wide range of SSL/TLS features (Warning: some of them are insecure!). +The Linux versions are compiled with the musl-cross toolchain and the openssl-pm-snapshot fork of OpenSSL in order to support a wide range of SSL/TLS features (Warning: some of them are insecure!). -## Release Packages +Compilation is done automatically with GitHub Actions. The binaries are uploaded to the [release section](https://github.com/ernw/static-toolbox/releases). The artifacts are also available in the artifacts of each GitHub Action. However, there are some limitations: -Precompiled and packaged releases are available in the tags/release section. +* Downloading of build artifacts in GitHub Ations currently requires a GitHub account +* Blobs in build artifacts are zipped by the GitHub frontend by default, even zip files themselves! Build artifact zips may contain other zip files. +* Build artifacts will expire after some time. -## Nmap +Therefore, it is recommended to download the binaries from the release section. -Precompiled versions of Nmap are available for the following operating systems/architectures: +## Building Status -* Linux x86 (nmap, ncat, nping) -* Linux x86_64 (nmap, ncat, nping) -* Linux armhf (nmap, ncat, nping) -* Linux aarch64 (nmap, ncat, nping) -* Windows x86 (nmap) +The following table shows the building status for the current toolset. The following architectures are currently supported: -## Socat +* x86 +* x86_64 +* ARMHF +* AARCH64 -Precompiled versions of socat are available for the following operating systems/architectures: - -* Linux x86 -* Linux x86_64 - -## GDB - -Precompiled versions of `gdb` and `gdbserver` are available for the following operating systems/architecturs: - -* Linux x86 -* Linux x86_64 -* Linux armhf -* Linux aarch64 - -# Building with Vagrant - -The recipes are supposed to be built in Docker containers. In case Docker is not available, it is recommended to use Vagrant to built everything in a VM, e.g. Nmap for Linux x86: - -``` -vagrant up -vagrant ssh -cd /vagrant/recipes/nmap/linux_x86 -sudo docker build -t static-toolbox-nmap-x86 . -sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86 -``` - -This is also the recommended way to run the build scripts without Docker without creating directories like `/build` and `/output` on your host system. +| Tool | Status | +| ---- | ------ | +|[Nmap](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22Nmap%22)|| +|[OpenSSH](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22OpenSSH%22)|| +|[socat](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22socat%22)|| +|[GDB & gdbserver](https://github.com/ernw/static-toolbox/actions?query=workflow%3AGDB)|| +|[tcpdump](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22tcpdump%22)|| +|[strace](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22strace%22)|| diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 28e2b46..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,26 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/artful64" - - config.vm.provider "virtualbox" do |vb| - vb.memory = "4096" - vb.cpus = 4 - end - - config.vm.provision "shell", inline: <<-SHELL - apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D - echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list - apt update - apt install -y linux-image-extra-$(uname -r) linux-image-extra-virtual - apt install -y docker-engine - service docker start - apt install -y python3-pip - pip3 install --upgrade pip - pip3 install docker-compose - systemctl daemon-reload - systemctl restart docker - apt install -y qemu - SHELL -end diff --git a/build/01_init.sh b/build/01_init.sh new file mode 100755 index 0000000..bd62b59 --- /dev/null +++ b/build/01_init.sh @@ -0,0 +1,4 @@ +#!/bin/sh +p=$(dirname "$0") +apk update && apk add bash +"$p"/install_deps_alpine.sh \ No newline at end of file diff --git a/build/02_install_build_compiler.sh b/build/02_install_build_compiler.sh new file mode 100755 index 0000000..bb70c9e --- /dev/null +++ b/build/02_install_build_compiler.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +function die(){ + echo "$1" + exit 1 +} + +if [ $# -ne 1 ];then + echo "Missing arch" + exit 1 +fi +ARCH="${1}" +case $ARCH in + x86_64|i686|aarch64) + ARCH="${ARCH}-linux-musl" + ;; + x86) + ARCH="i686-linux-musl" + ;; + arm) + ARCH="arm-linux-musleabihf" + ;; + *) + echo "Invalid arch ${ARCH}" + exit 1 + ;; +esac +HOST=http://musl.cc +echo "Fetching ${HOST}/${ARCH}-cross.tgz" +cd / +curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz || die "Failed to download build compiler package" +tar -xf ${ARCH}-cross.tgz || die "Failed to extract build compiler package" +rm ${ARCH}-cross.tgz || die "Failed to remove build compiler package" \ No newline at end of file diff --git a/build/install_deps_alpine.sh b/build/install_deps_alpine.sh new file mode 100755 index 0000000..15b52b7 --- /dev/null +++ b/build/install_deps_alpine.sh @@ -0,0 +1,31 @@ +#!/bin/sh +apk update +apk add \ + bash \ + git \ + perl \ + make \ + cmake \ + flex \ + bison \ + automake \ + autoconf \ + libtool \ + qemu-arm \ + qemu-aarch64 \ + qemu-ppc \ + qemu-ppc64 \ + file \ + texinfo \ + zip \ + wget \ + coreutils \ + gawk \ + gmp-dev \ + libunistring-dev \ + libffi-dev \ + lttng-ust-dev \ + curl \ + rsync \ + util-linux \ + patch \ No newline at end of file diff --git a/build/lib.sh b/build/lib.sh new file mode 100755 index 0000000..3d09984 --- /dev/null +++ b/build/lib.sh @@ -0,0 +1,306 @@ +#!/bin/bash +GIT_OPENSSL="https://github.com/drwetter/openssl-pm-snapshot.git" +GIT_BINUTILS_GDB="https://github.com/bminor/binutils-gdb.git" +GIT_READLINE="https://git.savannah.gnu.org/git/readline.git" +GIT_NCURSES="https://github.com/ThomasDickey/ncurses-snapshots.git" +GIT_LIBPCAP="https://github.com/the-tcpdump-group/libpcap.git" + +BUILD_DIRECTORY="/build" +OUTPUT_DIRECTORY="/output" +GCC_OPTS="-static -fPIC" +GXX_OPTS="-static -static-libstdc++ -fPIC" +TMP_DIR=$(mktemp -dt building_lib.XXXXXX) +trap "rm -rf ${TMP_DIR}" EXIT TERM + +# The init function that has to +# be called before running any +# other function. Should be used +# to configure the building env. +init_lib(){ + CURRENT_ARCH="$1" + if [ ! -d "$BUILD_DIRECTORY" ];then + mkdir -p $BUILD_DIRECTORY + fi + if [ ! -d "$OUTPUT_DIRECTORY" ];then + mkdir -p $OUTPUT_DIRECTORY + fi +} + +# Set a HTTP proxy for fetching +# software via HTTP and Git. +set_http_proxy(){ + proxy=$1 + export http_proxy="$proxy" + export https_proxy="$proxy" + git config --global http.proxy "$proxy" +} + +# Return a host triple for the +# selected architecture. +get_host_triple(){ + local host + if [ "$CURRENT_ARCH" == "x86" ];then + host="i686-linux-musl" + elif [ "$CURRENT_ARCH" == "x86_64" ];then + host="x86_64-linux-musl" + elif [ "$CURRENT_ARCH" == "armhf" ];then + host="arm-linux-musleabihf" + elif [ "$CURRENT_ARCH" == "aarch64" ];then + host="aarch64-linux-musl" + elif [ "$CURRENT_ARCH" == "ppc32" ];then + host="powerpc-linux-musl" + elif [ "$CURRENT_ARCH" == "ppc64" ];then + host="powerpc64-linux-musl" + fi + echo $host +} + +# Fetch and extract a resource via +# HTTP or clone a Git repository. +fetch(){ + if [ "$#" -ne 3 ];then + echo "fetch() requires a source, destination and method." + echo "Example: fetch http://github.com/test.git /build/test git" + exit 1 + fi + source=$1 + shift + destination=$1 + shift + method=$@ + # TODO: check if $source is a valid URL + if [ -d "$destination" ] || [ -f "$destination" ];then + echo "Destination ${destination} already exists, skipping." + return + fi + if [ "${method,,}" == "http" ];then + cd /tmp || { echo "Could not cd to /tmp"; exit 1; } + headers=$(mktemp headers.XXXXXX) + curl -L -D "$headers" -sOJ "$source" + filename=$(cat "$headers" | grep -o -E 'filename=.*$' | sed -e 's/filename=//') + filename=$(trim "$filename") + extract "$filename" "$destination" + trap "rm -rf ${headers} /tmp/'${filename}'" EXIT TERM + elif [ "${method,,}" == "git" ];then + git clone "$source" "$destination" + else + echo "Invalid method ${method}" + exit 1 + fi +} + +# Extract an archive to a +# destination directory. +extract(){ + if [ "$#" -ne 2 ];then + echo "extract() requires a source and destination." + exit 1 + fi + source=$1 + destination=$2 + if [ ! -d "$destination" ];then + mkdir -p "$destination" + fi + if [ -f "$source" ] ; then + case $source in + *.tar.bz2) tar xjf "$source" -C "$destination" --strip-components 1 ;; + *.tar.gz) tar xzf "$source" -C "$destination" --strip-components 1 ;; + *.tar.xz) tar xvfJ "$source" -C "$destination" --strip-components 1 ;; + *.tar) tar xf "$source" -C "$destination" --strip-components 1 ;; + *.tbz2) tar xjf "$source" -C "$destination" --strip-components 1 ;; + *.tgz) tar xzf "$source" -C "$destination" --strip-components 1 ;; + *) echo "'${source}' cannot be extracted via extract()" ;; + esac + else + echo "'${source}' is not a valid file" + fi +} + +# Remove leading and +# trailing whitespaces. +trim(){ + local var="$*" + var="${var#"${var%%[![:space:]]*}"}" + var="${var%"${var##*[![:space:]]}"}" + echo -n "$var" +} + +# Determine the version of +# a binary after building. +get_version(){ + local cmd="$1" + if [ -z "$cmd" ];then + echo "Please provide a command to determine the version" >&2 + echo "Example: /build/test --version | awk '{print \$2}'" >&2 + exit 1 + fi + local version="-" + if [ "$CURRENT_ARCH" == "armhf" ];then + if which qemu-arm 1>&2 2>/dev/null;then + cmd="qemu-arm ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-arm not found, skipping ARMHF version checks." >&2 + fi + elif [ "$CURRENT_ARCH" == "aarch64" ];then + if which qemu-aarch64 1>&2 2>/dev/null;then + cmd="qemu-aarch64 ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-aarch64 not found, skipping AARCH64 version checks." >&2 + fi + elif [ "$CURRENT_ARCH" == "ppc32" ];then + if which qemu-ppc 1>&2 2>/dev/null;then + cmd="qemu-ppc ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-ppc not found, skipping ppc32 version checks." >&2 + fi + elif [ "$CURRENT_ARCH" == "ppc64" ];then + if which qemu-ppc64 1>&2 2>/dev/null;then + cmd="qemu-ppc64 ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-ppc64 not found, skipping ppc64 version checks." >&2 + fi + else + version+=$(eval "$cmd") + fi + if [ "$version" == "-" ];then + version+="${CURRENT_ARCH}" + else + version+="-${CURRENT_ARCH}" + fi + echo "$version" +} + +lib_create_tmp_dir(){ + local tmp_dir=$(mktemp -dt -p ${TMP_DIR} tmpdir.XXXXXX) + echo "$tmp_dir" +} + +lib_check_lib_arch(){ + lib=$1 + if [ ! -f "$lib" ];then + echo "" + return + fi + local tmp_dir=$(lib_create_tmp_dir) + cp "$lib" "$tmp_dir" + bash -c "cd ${tmp_dir}; ar x $(basename ${lib})" + local output=$(find "${tmp_dir}" -name "*.o" -exec file {} \;) + if echo "$output" | grep -q "Intel 80386";then + echo "Arch of ${lib} is x86" >&2 + echo "x86" + elif echo "$output" | grep -q "x86-64";then + echo "Arch of ${lib} is x86_64" >&2 + echo "x86_64" + elif echo "$output" | grep -q "ARM aarch64";then + echo "Arch of ${lib} is armhf" >&2 + echo "armhf" + elif echo "$output" | grep -q "ARM,";then + echo "Arch of ${lib} is aarch64" >&2 + echo "aarch64" + else + echo "Could not determine arch of library ${lib}" >&2 + echo "" + fi +} + +lib_build_openssl(){ + local version=$1 + fetch "$GIT_OPENSSL" "${BUILD_DIRECTORY}/openssl" git + cd "${BUILD_DIRECTORY}/openssl" || { echo "Cannot cd to ${BUILD_DIRECTORY}/openssl"; exit 1; } + if [ -n "$version" ];then + git checkout "$version" || echo "Version ${version} not found, continuing with master." + fi + if [ -f "${BUILD_DIRECTORY}/openssl/libssl.a" ];then + lib_arch=$(lib_check_lib_arch "${BUILD_DIRECTORY}/openssl/libssl.a") + if [ "$lib_arch" != "$CURRENT_ARCH" ];then + echo "Rebuild for current arch" + git clean -fdx || true + else + echo "[+] OpenSSL already available for current arch, skipping building" + return + fi + fi + local openssl_arch + if [ "${CURRENT_ARCH}" == "x86" ] || + [ "${CURRENT_ARCH}" == "armhf" ];then + openssl_arch="linux-generic32" + elif [ "${CURRENT_ARCH}" == "x86_64" ];then + openssl_arch="linux-x86_64" + elif [ "${CURRENT_ARCH}" == "aarch64" ];then + openssl_arch="linux-generic64" + elif [ "${CURRENT_ARCH}" == "ppc32" ];then + openssl_arch="linux-ppc" + elif [ "${CURRENT_ARCH}" == "ppc64" ];then + openssl_arch="linux-ppc" + fi + CFLAGS="${GCC_OPTS}" \ + ./Configure \ + no-shared \ + "$openssl_arch" + make -j4 + echo "[+] Finished building OpenSSL ${CURRENT_ARCH}" +} + +lib_build_zlib(){ + fetch "$GIT_BINUTILS_GDB" "${BUILD_DIRECTORY}/binutils-gdb" git + cd "${BUILD_DIRECTORY}/binutils-gdb/zlib" || { echo "Cannot cd to ${BUILD_DIRECTORY}/binutils-gdb/zlib"; exit 1; } + git clean -fdx + CC="gcc ${GCC_OPTS}" \ + CXX="g++ ${GXX_OPTS}" \ + /bin/bash ./configure \ + --host="$(get_host_triple)" \ + --enable-static + make -j4 + echo "[+] Finished building zlib ${CURRENT_ARCH}" +} + +lib_build_readline(){ + fetch "$GIT_READLINE" "${BUILD_DIRECTORY}/readline" git + cd "${BUILD_DIRECTORY}/readline" || { echo "Cannot cd to ${BUILD_DIRECTORY}/readline"; exit 1; } + git clean -fdx + CFLAGS="${GCC_OPTS}" \ + CXXFLAGS="${GXX_OPTS}" \ + ./configure \ + --host="$(get_host_triple)" \ + --disable-shared \ + --enable-static + make -j4 + echo "[+] Finished building readline ${CURRENT_ARCH}" +} + +lib_build_ncurses(){ + fetch "$GIT_NCURSES" "${BUILD_DIRECTORY}/ncurses" git + cd "${BUILD_DIRECTORY}/ncurses" || { echo "Cannot cd to ${BUILD_DIRECTORY}/ncurses"; exit 1; } + git clean -fdx + git checkout v6_2 + + CMD="CFLAGS=\"${GCC_OPTS}\" " + CMD+="CXXFLAGS=\"${GXX_OPTS}\" " + CMD+="./configure --host=$(get_host_triple) --disable-shared --enable-static" + if [ "$CURRENT_ARCH"!="x86" -a "$CURRENT_ARCH"!="x86_64" ];then + CMD+=" --with-build-cc=/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc" + fi + eval "$CMD" + make -j4 + echo "[+] Finished building ncurses ${CURRENT_ARCH}" +} + +lib_build_libpcap(){ + fetch "$GIT_LIBPCAP" "${BUILD_DIRECTORY}/libpcap" git + cd "${BUILD_DIRECTORY}/libpcap" || { echo "Cannot cd to ${BUILD_DIRECTORY}/libpcap"; exit 1; } + git clean -fdx + git checkout libpcap-1.9.1 + CFLAGS="${GCC_OPTS}" \ + CXXFLAGS="${GXX_OPTS}" \ + ./configure \ + --host="$(get_host_triple)" \ + --with-pcap=linux \ + --disable-shared \ + --enable-static + make -j4 + echo "[+] Finished building libpcap ${CURRENT_ARCH}" +} \ No newline at end of file diff --git a/build/targets/build_gdb.sh b/build/targets/build_gdb.sh new file mode 100755 index 0000000..658b7e7 --- /dev/null +++ b/build/targets/build_gdb.sh @@ -0,0 +1,59 @@ +#!/bin/bash +if [ -z "$GITHUB_WORKSPACE" ];then + echo "GITHUB_WORKSPACE environemnt variable not set!" + exit 1 +fi +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +set -e +set -o pipefail +set -x +source $GITHUB_WORKSPACE/build/lib.sh +init_lib $1 + +build_gdb() { + fetch "$GIT_BINUTILS_GDB" "${BUILD_DIRECTORY}/binutils-gdb" git + cd "${BUILD_DIRECTORY}/binutils-gdb/" || { echo "Cannot cd to ${BUILD_DIRECTORY}/binutils-gdb/"; exit 1; } + git clean -fdx + git checkout gdb-12.1-release + CMD="CFLAGS=\"${GCC_OPTS}\" " + CMD+="CXXFLAGS=\"${GXX_OPTS}\" " + CMD+="LDFLAGS=\"-static\" " + if [ "$CURRENT_ARCH" != "x86_64" ];then + CMD+="CC_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc\" " + CMD+="CPP_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++\" " + fi + CMD+="${BUILD_DIRECTORY}/binutils-gdb/configure --build=x86_64-linux-musl --host=$(get_host_triple) " + CMD+="--disable-shared --enable-static --enable-gdbserver --disable-nls --disable-inprocess-agent" + + mkdir -p "${BUILD_DIRECTORY}/gdb_build" + cd "${BUILD_DIRECTORY}/gdb_build/" + eval "$CMD" + make -j4 + + strip "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver" +} + +main() { + build_gdb + if [ ! -f "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" ] || \ + [ ! -f "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver" ];then + echo "[-] Building GDB ${CURRENT_ARCH} failed!" + exit 1 + fi + GDB_VERSION=$(get_version "${BUILD_DIRECTORY}/gdb_build/gdb/gdb --version |head -n1 |awk '{print \$4}'") + GDBSERVER_VERSION=$(get_version "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver --version |head -n1 |awk '{print \$4}'") + version_number=$(echo "$GDB_VERSION" | cut -d"-" -f2) + cp "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" "${OUTPUT_DIRECTORY}/gdb${GDB_VERSION}" + cp "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver" "${OUTPUT_DIRECTORY}/gdbserver${GDBSERVER_VERSION}" + echo "[+] Finished building GDB ${CURRENT_ARCH}" + + echo "PACKAGED_NAME=gdb${GDB_VERSION}" >> $GITHUB_OUTPUT + echo "PACKAGED_NAME_PATH=/output/*" >> $GITHUB_OUTPUT + echo "PACKAGED_VERSION=${version_number}" >> $GITHUB_OUTPUT +} + +main diff --git a/build/targets/build_nmap.sh b/build/targets/build_nmap.sh new file mode 100755 index 0000000..6e6cfa7 --- /dev/null +++ b/build/targets/build_nmap.sh @@ -0,0 +1,74 @@ +#!/bin/bash +if [ -z "$GITHUB_WORKSPACE" ];then + echo "GITHUB_WORKSPACE environemnt variable not set!" + exit 1 +fi +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +set -e +set -o pipefail +set -x +source $GITHUB_WORKSPACE/build/lib.sh +init_lib $1 + +build_nmap() { + fetch "https://github.com/nmap/nmap.git" "${BUILD_DIRECTORY}/nmap" git + cd "${BUILD_DIRECTORY}/nmap" + git clean -fdx || true + # make sure we only build the static libraries + sed -i '/build-zlib: $(ZLIBDIR)\/Makefile/!b;n;c\\t@echo Compiling zlib; cd $(ZLIBDIR) && $(MAKE) static;' "${BUILD_DIRECTORY}/nmap/Makefile.in" + CC='gcc -static -fPIC' \ + CXX='g++ -static -static-libstdc++ -fPIC' \ + LD=ld \ + LDFLAGS="-L/build/openssl" \ + ./configure \ + --host="$(get_host_triple)" \ + --without-ndiff \ + --without-zenmap \ + --without-nmap-update \ + --without-libssh2 \ + --with-pcap=linux \ + --with-openssl="${BUILD_DIRECTORY}/openssl" + sed -i -e "s/shared\: /shared\: #/" "${BUILD_DIRECTORY}/nmap/libpcap/Makefile" + make + strip nmap ncat/ncat nping/nping +} + +main() { + lib_build_openssl + build_nmap + if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" -o \ + ! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" -o \ + ! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then + echo "[-] Building Nmap ${CURRENT_ARCH} failed!" + exit 1 + fi + VERSION_CMD=$(get_version "${BUILD_DIRECTORY}/nmap/nmap --version") + NMAP_VERSION=$(echo "$VERSION_CMD" | grep "Nmap version" | awk '{print $3}') + if [ -n "$NMAP_VERSION" ];then + NMAP_VERSION="-${NMAP_VERSION}" + fi + cp "${BUILD_DIRECTORY}/nmap/nmap" "${OUTPUT_DIRECTORY}/nmap${NMAP_VERSION}" + cp "${BUILD_DIRECTORY}/nmap/ncat/ncat" "${OUTPUT_DIRECTORY}/ncat${NMAP_VERSION}" + cp "${BUILD_DIRECTORY}/nmap/nping/nping" "${OUTPUT_DIRECTORY}/nping${NMAP_VERSION}" + echo "[+] Finished building Nmap ${CURRENT_ARCH}" + NMAP_COMMIT=$(cd "${BUILD_DIRECTORY}/nmap/" && git rev-parse --short HEAD) + NMAP_DIR="${OUTPUT_DIRECTORY}/nmap-data${NMAP_VERSION}-${NMAP_COMMIT}" + if [ ! -d "$NMAP_DIR" ];then + echo "[-] ${NMAP_DIR} does not exist, creating it" + mkdir -p "${NMAP_DIR}" + fi + if [ -n "$(ls $NMAP_DIR)" ];then + echo "[+] Data directory is not empty" + exit + fi + cd "${BUILD_DIRECTORY}/nmap" + make install + cp -r /usr/local/share/nmap/* $NMAP_DIR + echo "[+] Copied data to Nmap data dir" +} + +main diff --git a/build/targets/build_openssh.sh b/build/targets/build_openssh.sh new file mode 100755 index 0000000..37a4c0a --- /dev/null +++ b/build/targets/build_openssh.sh @@ -0,0 +1,57 @@ +#!/bin/bash +if [ -z "$GITHUB_WORKSPACE" ];then + echo "GITHUB_WORKSPACE environemnt variable not set!" + exit 1 +fi +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +set -e +set -o pipefail +set -x +source $GITHUB_WORKSPACE/build/lib.sh +init_lib $1 + +build_openssh() { + fetch "https://github.com/openssh/openssh-portable.git" "${BUILD_DIRECTORY}/openssh-portable" git + cd "${BUILD_DIRECTORY}/openssh-portable" + git checkout V_9_1_P1 + git clean -fdx + autoreconf -i + CC="gcc ${GCC_OPTS}" \ + CXX="g++ ${GXX_OPTS}" \ + CXXFLAGS="-I${BUILD_DIRECTORY}/openssl -I${BUILD_DIRECTORY}/binutils-gdb/zlib" \ + ./configure \ + --with-ssl-engine \ + --with-ssl-dir="${BUILD_DIRECTORY}/openssl" \ + --with-zlib="${BUILD_DIRECTORY}/binutils-gdb/zlib" \ + --with-ldflags=-static \ + --host="$(get_host_triple)" + make -j4 + strip ssh sshd +} + +main() { + lib_build_openssl + lib_build_zlib + build_openssh + if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" -o \ + ! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then + echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!" + exit 1 + fi + OPENSSH_VERSION=$(get_version "${BUILD_DIRECTORY}/openssh-portable/ssh -V 2>&1 | awk '{print \$1}' | sed 's/,//g'") + version_number=$(echo "$OPENSSH_VERSION" | cut -d"-" -f2 | cut -d"_" -f2) + cp "${BUILD_DIRECTORY}/openssh-portable/ssh" "${OUTPUT_DIRECTORY}/ssh${OPENSSH_VERSION}" + cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}" + echo "[+] Finished building OpenSSH ${CURRENT_ARCH}" + + OPENSSH_VERSION=$(echo $OPENSSH_VERSION | sed 's/-//') + echo "PACKAGED_NAME=${OPENSSH_VERSION} >> $GITHUB_OUTPUT" + echo "PACKAGED_NAME_PATH=/output/* >> $GITHUB_OUTPUT" + echo "PACKAGED_VERSION=${version_number} >> $GITHUB_OUTPUT" +} + +main diff --git a/build/targets/build_socat.sh b/build/targets/build_socat.sh new file mode 100755 index 0000000..5550a88 --- /dev/null +++ b/build/targets/build_socat.sh @@ -0,0 +1,49 @@ +#!/bin/bash +if [ -z "$GITHUB_WORKSPACE" ];then + echo "GITHUB_WORKSPACE environemnt variable not set!" + exit 1 +fi +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64|ppc32|ppc64]" + echo "Example: ${0} x86_64" + exit 1 +fi +set -e +set -o pipefail +set -x +source $GITHUB_WORKSPACE/build/lib.sh +init_lib "$1" + +build_socat() { + fetch "http://repo.or.cz/socat.git" "${BUILD_DIRECTORY}/socat" git + cd "${BUILD_DIRECTORY}/socat" + git clean -fdx + autoconf + CFLAGS="${GCC_OPTS}" \ + CXXFLAGS="${GXX_OPTS}" \ + CPPFLAGS="-I${BUILD_DIRECTORY} -I${BUILD_DIRECTORY}/openssl/include -DNETDB_INTERNAL=-1" \ + LDFLAGS="-L${BUILD_DIRECTORY}/readline -L${BUILD_DIRECTORY}/ncurses/lib -L${BUILD_DIRECTORY}/openssl" \ + ./configure \ + --host="$(get_host_triple)" + make -j4 + strip socat +} + +main() { + #sudo apt install yodl + lib_build_openssl + lib_build_ncurses + lib_build_readline + build_socat + local version + version=$(get_version "${BUILD_DIRECTORY}/socat/socat -V | grep 'socat version' | awk '{print \$3}'") + version_number=$(echo "$version" | cut -d"-" -f2) + cp "${BUILD_DIRECTORY}/socat/socat" "${OUTPUT_DIRECTORY}/socat${version}" + echo "[+] Finished building socat ${CURRENT_ARCH}" + + echo "PACKAGED_NAME=socat${version}" >> $GITHUB_OUTPUT + echo "PACKAGED_NAME_PATH=${OUTPUT_DIRECTORY}/*" >> $GITHUB_OUTPUT + echo "PACKAGED_VERSION=${version_number}" >> $GITHUB_OUTPUT +} + +main diff --git a/build/targets/build_strace.sh b/build/targets/build_strace.sh new file mode 100755 index 0000000..b87db5c --- /dev/null +++ b/build/targets/build_strace.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e +set -x +set -o pipefail +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +source $GITHUB_WORKSPACE/build/lib.sh +init_lib "$1" + +VERSION="v6.3" + +build_strace() { + fetch "https://github.com/strace/strace" "${BUILD_DIRECTORY}/strace" git + cd "${BUILD_DIRECTORY}/strace" + git clean -fdx + git checkout "$VERSION" + ./bootstrap + CMD="CFLAGS=\"${GCC_OPTS}\" " + CMD+="CXXFLAGS=\"${GXX_OPTS}\" " + CMD+="LDFLAGS=\"-static -pthread\" " + if [ "$CURRENT_ARCH" != "x86_64" ];then + CMD+="CC_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc\" " + CMD+="CPP_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++ -E\" " + CMD+="CXX_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++\" " + fi + CMD+="./configure --disable-mpers --host=$(get_host_triple)" + eval "$CMD" + make CFLAGS="-w" -j4 + strip "${BUILD_DIRECTORY}/strace/src/strace" +} + +main() { + build_strace + local version + version=$(get_version "${BUILD_DIRECTORY}/strace/src/strace -V 2>&1 | head -n1 | awk '{print \$4}'") + version_number=$(echo "$version" | cut -d"-" -f2) + cp "${BUILD_DIRECTORY}/strace/src/strace" "${OUTPUT_DIRECTORY}/strace${version}" + echo "[+] Finished building strace ${CURRENT_ARCH}" + + echo "PACKAGED_NAME=strace${version}" >> $GITHUB_OUTPUT + echo "PACKAGED_NAME_PATH=${OUTPUT_DIRECTORY}/*" >> $GITHUB_OUTPUT + echo "PACKAGED_VERSION=${version_number}" >> $GITHUB_OUTPUT +} + +main diff --git a/build/targets/build_tcpdump.sh b/build/targets/build_tcpdump.sh new file mode 100755 index 0000000..3c6f8d6 --- /dev/null +++ b/build/targets/build_tcpdump.sh @@ -0,0 +1,47 @@ +#!/bin/bash +if [ -z "$GITHUB_WORKSPACE" ];then + echo "GITHUB_WORKSPACE environemnt variable not set!" + exit 1 +fi +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +set -e +set -o pipefail +set -x +source $GITHUB_WORKSPACE/build/lib.sh +init_lib "$1" + +build_tcpdump() { + fetch "https://github.com/the-tcpdump-group/tcpdump.git" "${BUILD_DIRECTORY}/tcpdump" git + cd "${BUILD_DIRECTORY}/tcpdump" + git clean -fdx + git checkout tcpdump-4.9.3 + export LIBPCAP_PATH="${BUILD_DIRECTORY}/libpcap" + CFLAGS="${GCC_OPTS} -I${LIBPCAP_PATH} -L${LIBPCAP_PATH}" \ + CXXFLAGS="${GXX_OPTS}" \ + CPPFLAGS="-static" \ + LDFLAGS="-static" \ + ./configure \ + --host="$(get_host_triple)" + make -j4 + strip tcpdump +} + +main() { + lib_build_libpcap + build_tcpdump + local version + version=$(get_version "${BUILD_DIRECTORY}/tcpdump/tcpdump --version 2>&1 | head -n1 | awk '{print \$3}'") + version_number=$(echo "$version" | cut -d"-" -f2) + cp "${BUILD_DIRECTORY}/tcpdump/tcpdump" "${OUTPUT_DIRECTORY}/tcpdump${version}" + echo "[+] Finished building tcpdump ${CURRENT_ARCH}" + + echo "PACKAGED_NAME=tcpdump${version}" >> $GITHUB_OUTPUT + echo "PACKAGED_NAME_PATH=${OUTPUT_DIRECTORY}/*" >> $GITHUB_OUTPUT + echo "PACKAGED_VERSION=${version_number}" >> $GITHUB_OUTPUT +} + +main diff --git a/build/targets/build_tcpreplay.sh b/build/targets/build_tcpreplay.sh new file mode 100755 index 0000000..ed326b1 --- /dev/null +++ b/build/targets/build_tcpreplay.sh @@ -0,0 +1,57 @@ +#!/bin/bash +set -e +set -x +set -o pipefail +if [ "$#" -ne 1 ];then + echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Example: ${0} x86_64" + exit 1 +fi +source $GITHUB_WORKSPACE/build/lib.sh +init_lib "$1" + +build_autogen(){ + fetch "http://ftp.gnu.org/gnu/autogen/rel5.16.2/autogen-5.16.2.tar.gz" "${BUILD_DIRECTORY}/autogen" http + cd "${BUILD_DIRECTORY}/autogen" + automake + CFLAGS="${GCC_OPTS}" \ + CXXFLAGS="${GXX_OPTS}" \ + CPPFLAGS="-static" \ + LDFLAGS="-static" \ + ./configure \ + --host="$(get_host_triple)" + make -j4 + make install +} + +build_tcpreplay() { + fetch "https://github.com/appneta/tcpreplay.git" "${BUILD_DIRECTORY}/tcpdump" git + cd "${BUILD_DIRECTORY}/tcpreplay" + git clean -fdx + git checkout v4.3.3 + export LIBPCAP_PATH="${BUILD_DIRECTORY}/libpcap" + ./autogen.sh + CFLAGS="${GCC_OPTS} -I${LIBPCAP_PATH} -L${LIBPCAP_PATH}" \ + CXXFLAGS="${GXX_OPTS}" \ + CPPFLAGS="-static" \ + LDFLAGS="-static" \ + ./configure \ + --host="$(get_host_triple)" + make -j4 + strip tcpreplay +} + +main() { + lib_build_libpcap + build_autogen + build_tcpreplay + local version + version=$(get_version "${BUILD_DIRECTORY}/tcpreplay/tcpreplay --version 2>&1 | head -n1 | awk '{print \$3}'") + cp "${BUILD_DIRECTORY}/tcpreplay/tcpreplay" "${OUTPUT_DIRECTORY}/tcpreplay" + echo "[+] Finished building tcpreplay ${CURRENT_ARCH}" + + echo "PACKAGED_NAME=tcpreplay${version}" + echo "PACKAGED_NAME_PATH=${OUTPUT_DIRECTORY}/*" +} + +main diff --git a/package/targets/nmap/package.sh b/package/targets/nmap/package.sh new file mode 100755 index 0000000..51f2d05 --- /dev/null +++ b/package/targets/nmap/package.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -x +if [ $# -lt 2 ];then + echo "Usage: ${0} <output directory> <arch>" >&2 + echo "Example: ${0} /output x86_64" >&2 + exit 2 +fi +output_dir=$1 +arch=$2 +tmp_dir=$(mktemp -dt packaging.XXXXXX) +trap exit_script EXIT TERM + +if [ ! -d "$output_dir" ];then + echo "Invalid directory ${output_dir}" + exit 1 +fi + +exit_script(){ + rm -rf "$tmp_dir" +} + +echo "tmp_dir: ${tmp_dir}" + +version="" + +for f in $(ls "$output_dir");do + case "$f" in + nmap-data*) + mv "${output_dir}/${f}" "${tmp_dir}/data" + ;; + nmap*) + mv "${output_dir}/${f}" "${tmp_dir}/nmap" + version=${f//nmap-/} + ;; + nping*) + mv "${output_dir}/${f}" "${tmp_dir}/nping" + ;; + ncat*) + mv "${output_dir}/${f}" "${tmp_dir}/ncat" + ;; + *) + echo "This file should not be there: ${output_dir}/${f}" + ;; + esac +done + +if [ ! -d /packaged ];then + mkdir /packaged +fi +cp $GITHUB_WORKSPACE/package/targets/nmap/run-nmap.sh "$tmp_dir" +cd "$tmp_dir" + +TARBALL="nmap-${version}-${arch}-portable.tar.gz" +tar czf "${output}/${TARBALL}" -C "$tmp_dir" . +cp "${output}/${TARBALL}" /packaged +echo "PACKAGED_TARBALL=${TARBALL}" >> $GITHUB_OUTPUT +echo "PACKAGED_TARBALL_PATH=/packaged/${TARBALL}" >> $GITHUB_OUTPUT + +ZIP="nmap-${version}-${arch}-portable.zip" +zip -r -q "${output}/${ZIP}" . +cp "${output}/${ZIP}" /packaged +echo "PACKAGED_ZIP=${ZIP}" >> $GITHUB_OUTPUT +echo "PACKAGED_ZIP_PATH=/packaged/${ZIP}" >> $GITHUB_OUTPUT + +echo "PACKAGED_VERSION=${version}" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/packaging/run-nmap.ps1 b/package/targets/nmap/run-nmap.ps1 similarity index 100% rename from packaging/run-nmap.ps1 rename to package/targets/nmap/run-nmap.ps1 diff --git a/packaging/run-nmap.sh b/package/targets/nmap/run-nmap.sh similarity index 100% rename from packaging/run-nmap.sh rename to package/targets/nmap/run-nmap.sh diff --git a/packaging/package.sh b/packaging/package.sh deleted file mode 100755 index 59c8ca4..0000000 --- a/packaging/package.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -if [ $# -lt 2 ];then - echo "Usage: ${0} <commit> <version?" >&2 - echo "Example: ${0} b5bd185 7.70SVN" >&2 - exit 2 -fi - -commit=$1 -version=$2 -architectures=(aarch64 armhf x86 x86_64) -tmp_dir=$(mktemp -dt packaging.XXXXXX) -trap exit_script EXIT TERM - -exit_script(){ - rm -rf "$tmp_dir" -} - -echo "tmp_dir: ${tmp_dir}" - -for arch in "${architectures[@]}";do - arch_dir="${tmp_dir}/nmap-${version}-${commit}-${arch}-portable" - mkdir -p "$arch_dir" - find ../bin/linux/${arch}/ -name "*-${commit}" -exec cp {} "${arch_dir}" \; - echo "version: ${version}" - ls -la "$arch_dir" - if [ -s "${arch_dir}/nmap-${version}-${commit}" ];then - mv "${arch_dir}/nmap-${version}-${commit}" "${arch_dir}/nmap" - mv "${arch_dir}/ncat-${version}-${commit}" "${arch_dir}/ncat" - # Note: Nping version starts with "0.". - mv "${arch_dir}/nping-0.${version}-${commit}" "${arch_dir}/nping" - elif [ -s "${arch_dir}/nmap-${commit}" ];then - mv "${arch_dir}/nmap-${commit}" "${arch_dir}/nmap" - mv "${arch_dir}/ncat-${commit}" "${arch_dir}/ncat" - mv "${arch_dir}/nping-${commit}" "${arch_dir}/nping" - else - echo "Nmap binaries for ${arch} not found!" - read - continue - fi - if [ -d "../data/nmap-data-${version}-${commit}" ];then - cp -r "../data/nmap-data-${version}-${commit}" "${arch_dir}/data" - elif [ -d "../data/nmap-data-0.${version}-${commit}" ];then - cp -r "../data/nmap-data-0.${version}-${commit}" "${arch_dir}/data" - else - echo "Nmap data directory not found!" - read - continue - fi - cp run-nmap.sh "$arch_dir" - tar czf "${tmp_dir}/nmap-${version}-${commit}-${arch}-portable.tar.gz" -C "$tmp_dir" "nmap-${version}-${commit}-${arch}-portable" - cd "$tmp_dir" - zip -r -q "${tmp_dir}/nmap-${version}-${commit}-${arch}-portable.zip" "nmap-${version}-${commit}-${arch}-portable" - cd - - rm -rf "$arch_dir" -done - -echo "Finished packing. Got the following releases:" -ls -la "$tmp_dir" -echo "Ready to copy them. Press CTRL+C to arbort, RETURN to continue...." -read -cp "${tmp_dir}/"* ../packaged diff --git a/patches/gdb/gdb-aarch64-header-sigcontext-fix.patch b/patches/gdb/gdb-aarch64-header-sigcontext-fix.patch new file mode 100644 index 0000000..c679ae3 --- /dev/null +++ b/patches/gdb/gdb-aarch64-header-sigcontext-fix.patch @@ -0,0 +1,18 @@ +--- /tmp/aarch64-linux-musl-cross/aarch64-linux-musl/include/asm/sigcontext.h ++++ /aarch64-linux-musl-cross/aarch64-linux-musl/include/asm/sigcontext.h +@@ -25,6 +25,7 @@ + * Signal context structure - contains all info to do with the state + * before the signal handler was invoked. + */ ++#if false + struct sigcontext { + __u64 fault_address; + /* AArch64 registers */ +@@ -127,6 +128,7 @@ + __u16 vl; + __u16 __reserved[3]; + }; ++#endif + + #endif /* !__ASSEMBLY__ */ + diff --git a/recipes/gdb/README.md b/recipes/gdb/README.md deleted file mode 100644 index 88a5803..0000000 --- a/recipes/gdb/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# GDB - -## Build Linux x86 - -``` -sudo docker build -t static-toolbox-gdb-x86 . -sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-x86 -``` - -## Build Linux x86_64 - -``` -sudo docker build -t static-toolbox-gdb-x86-64 . -sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-x86-64 -``` - -## Build Linux armhf - -``` -sudo docker build -t static-toolbox-gdb-armhf . -sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-armhf -``` - -## Build Linux aarch64 - -``` -sudo docker build -t static-toolbox-gdb-aarch64 . -sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-aarch64 diff --git a/recipes/gdb/linux_aarch64/Dockerfile b/recipes/gdb/linux_aarch64/Dockerfile deleted file mode 100644 index a1151b8..0000000 --- a/recipes/gdb/linux_aarch64/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python \ - binutils-dev \ - lib32z1-dev \ - byacc \ - flex \ - texinfo \ - qemu -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_aarch64.sh -CMD /build/build_aarch64.sh diff --git a/recipes/gdb/linux_aarch64/build_aarch64.sh b/recipes/gdb/linux_aarch64/build_aarch64.sh deleted file mode 100644 index 47e61d3..0000000 --- a/recipes/gdb/linux_aarch64/build_aarch64.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/binutils-gdb" ];then - git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb - fi - cd /build/binutils-gdb - git checkout binutils-2_30 - cd - -} - -build_musl_aarch64() { - cd /build/musl - git clean -fdx - echo "ARCH=arm64" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - echo "TRIPLE=aarch64-linux-musleabi" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross aarch64" -} - -build_gdb_aarch64() { - cd /build/binutils-gdb - git clean -fdx - make clean || true - - cd /build/binutils-gdb/bfd - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi - make -j4 - - cd /build/binutils-gdb/readline - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/opcodes - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libiberty - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libdecnumber - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/zlib - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld . - make zlibstatic - - cd /build/binutils-gdb/gdb - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - LDFLAGS='-static' \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-interprocess-agent - make -j4 - - cd /build/binutils-gdb/gdb/gdbserver/ - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - LDFLAGS='-static' \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=aarch64-none-linux-gnueabi \ - --disable-interprocess-agent - make -j4 - - /opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver -} - -build_aarch64(){ - OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/aarch64 - mkdir -p $OUT_DIR - build_musl_aarch64 - build_gdb_aarch64 - GDB_VERSION= - GDBSERVER_VERSION= - if which qemu-aarch64 >/dev/null;then - GDB_VERSION="-$(qemu-aarch64 /build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')" - GDBSERVER_VERSION="-$(qemu-aarch64 /build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')" - fi - cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-aarch64${GDB_VERSION}" - cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-aarch64${GDBSERVER_VERSION}" - echo "[+] Finished building aarch64" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_aarch64 -} - -main diff --git a/recipes/gdb/linux_armhf/Dockerfile b/recipes/gdb/linux_armhf/Dockerfile deleted file mode 100644 index c0f9b40..0000000 --- a/recipes/gdb/linux_armhf/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python \ - binutils-dev \ - lib32z1-dev \ - byacc \ - flex \ - texinfo \ - qemu -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_armhf.sh -CMD /build/build_armhf.sh diff --git a/recipes/gdb/linux_armhf/build_armhf.sh b/recipes/gdb/linux_armhf/build_armhf.sh deleted file mode 100644 index 1c08c7b..0000000 --- a/recipes/gdb/linux_armhf/build_armhf.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/binutils-gdb" ];then - git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb - fi - cd /build/binutils-gdb - git checkout binutils-2_30 - cd - -} - -build_musl_armhf() { - cd /build/musl - git clean -fdx - echo "ARCH=arm" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - echo "TRIPLE=arm-linux-musleabihf" >> config.sh - echo "GCC_BOOTSTRAP_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh - echo "GCC_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross armhf" -} - -build_gdb_armhf() { - cd /build/binutils-gdb - git clean -fdx - make clean || true - - cd /build/binutils-gdb/bfd - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi - make -j4 - - cd /build/binutils-gdb/readline - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/opcodes - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libiberty - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libdecnumber - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/zlib - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld . - make zlibstatic - - cd /build/binutils-gdb/gdb - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - LDFLAGS='-static' \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --disable-interprocess-agent - make -j4 - - cd /build/binutils-gdb/gdb/gdbserver/ - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - LDFLAGS='-static' \ - ./configure \ - --host=x86_64-linux-gnu \ - --target=arm-none-linux-gnueabi \ - --enable-static=yes \ - --disable-interprocess-agent - make -j4 - - /opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver -} - -build_armhf(){ - OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/armhf - mkdir -p $OUT_DIR - build_musl_armhf - build_gdb_armhf - GDB_VERSION= - GDBSERVER_VERSION= - if which qemu-arm >/dev/null;then - GDB_VERSION="-$(qemu-arm /build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')" - GDBSERVER_VERSION="-$(qemu-arm /build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')" - fi - cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-armhf${GDB_VERSION}" - cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-armhf${GDBSERVER_VERSION}" - echo "[+] Finished building armhf" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_armhf -} - -main diff --git a/recipes/gdb/linux_x86/Dockerfile b/recipes/gdb/linux_x86/Dockerfile deleted file mode 100644 index 8e4b25c..0000000 --- a/recipes/gdb/linux_x86/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python \ - binutils-dev \ - lib32z1-dev \ - byacc \ - flex \ - texinfo -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_x86.sh -CMD /build/build_x86.sh diff --git a/recipes/gdb/linux_x86/build_x86.sh b/recipes/gdb/linux_x86/build_x86.sh deleted file mode 100644 index 8efe9af..0000000 --- a/recipes/gdb/linux_x86/build_x86.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/binutils-gdb" ];then - git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb - fi - cd /build/binutils-gdb - git checkout binutils-2_30 - cd - -} - -build_musl_x86() { - cd /build/musl - git clean -fdx - echo "ARCH=i486" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross x86" -} - -build_gdb_x86() { - cd /build/binutils-gdb - git clean -fdx - make clean || true - - cd /build/binutils-gdb/bfd - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - LDFLAGS="" \ - ./configure - make -j4 - - cd /build/binutils-gdb/readline - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --target=i686-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/opcodes - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --target=i686-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libiberty - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --target=i686-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libdecnumber - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --target=i686-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/zlib - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld . - make zlibstatic - - cd /build/binutils-gdb/gdb - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -m32 -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -m32 -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=i686-linux-gnu \ - --disable-interprocess-agent - make -j4 - - cd /build/binutils-gdb/gdb/gdbserver/ - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -m32 -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -m32 -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=i686-linux-gnu \ - --disable-interprocess-agent - make -j4 - - /opt/cross/i486-linux-musl/bin/i486-linux-musl-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver -} - -build_x86(){ - OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86 - mkdir -p $OUT_DIR - build_musl_x86 - build_gdb_x86 - GDB_VERSION="-$(/build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')" - GDBSERVER_VERSION="-$(/build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')" - cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-x86${GDB_VERSION}" - cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-x86${GDBSERVER_VERSION}" - echo "[+] Finished building x86" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_x86 -} - -main diff --git a/recipes/gdb/linux_x86_64/Dockerfile b/recipes/gdb/linux_x86_64/Dockerfile deleted file mode 100644 index 9732d8d..0000000 --- a/recipes/gdb/linux_x86_64/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python \ - binutils-dev \ - lib32z1-dev \ - byacc \ - flex \ - texinfo -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_x86_64.sh -CMD /build/build_x86_64.sh diff --git a/recipes/gdb/linux_x86_64/build_x86_64.sh b/recipes/gdb/linux_x86_64/build_x86_64.sh deleted file mode 100644 index 9ebf25f..0000000 --- a/recipes/gdb/linux_x86_64/build_x86_64.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/binutils-gdb" ];then - git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb - fi - cd /build/binutils-gdb - git checkout binutils-2_30 - cd - -} - -build_musl_x86_64() { - cd /build/musl - git clean -fdx - ./build.sh - echo "[+] Finished building musl-cross x86_64" -} - -build_gdb_x86_64() { - cd /build/binutils-gdb - git clean -fdx - make clean || true - - cd /build/binutils-gdb/bfd - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - LDFLAGS="" \ - ./configure - make -j4 - - cd /build/binutils-gdb/readline - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - ./configure \ - --target=x86_64-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/opcodes - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - ./configure \ - --target=x86_64-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libiberty - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - ./configure \ - --target=x86_64-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/libdecnumber - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - ./configure \ - --target=x86_64-linux-gnu \ - --disable-shared \ - --enable-static - make -j4 - - cd /build/binutils-gdb/zlib - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld - make zlibstatic - - cd /build/binutils-gdb/gdb - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - LDFLAGS='-static' \ - ./configure \ - --enable-static=yes \ - --host=x86_64-linux-gnu \ - --target=x86_64-linux-gnu \ - --disable-interprocess-agent - make -j4 - - cd /build/binutils-gdb/gdb/gdbserver/ - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - LDFLAGS='-static' \ - ./configure \ - --enable-static=yes \ - --disable-interprocess-agent - make -j4 - - /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver -} - -build_x86_64(){ - OUT_DIR_x86=/output/`uname | tr 'A-Z' 'a-z'`/x86_64 - mkdir -p $OUT_DIR_x86 - build_musl_x86_64 - build_gdb_x86_64 - GDB_VERSION="-$(/build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')" - GDBSERVER_VERSION="-$(/build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')" - cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-x86_64${GDB_VERSION}" - cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-x86_64${GDBSERVER_VERSION}" - echo "[+] Finished building x86_64" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_x86_64 -} - -main diff --git a/recipes/nmap/README.md b/recipes/nmap/README.md deleted file mode 100644 index 4e5d76a..0000000 --- a/recipes/nmap/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Nmap - -## Build Linux x86 - -``` -sudo docker build -t static-toolbox-nmap-x86 . -sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86 -``` - -## Build Linux x86_64 - -``` -sudo docker build -t static-toolbox-nmap-x86-64 . -sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86-64 -``` - -## Build Linux armhf - -``` -sudo docker build -t static-toolbox-nmap-armhf . -sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-armhf -``` - -## Build Linux aarch64 - -``` -sudo docker build -t static-toolbox-nmap-aarch64 . -sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-aarch64 -``` - -## Using the Nmap data directory - -In order to use features like script scanning, we also need the Nmap data files that are typically installed into `/usr/share/nmap`. They are available in the `data/nmap` directory. Just copy this directory to the target system, e.g. into `/tmp/nmap-data` and run Nmap like this: - -``` -NMAPDIR=/tmp/nmap-data ./nmap -``` diff --git a/recipes/nmap/linux_aarch64/Dockerfile b/recipes/nmap/linux_aarch64/Dockerfile deleted file mode 100644 index 91d395e..0000000 --- a/recipes/nmap/linux_aarch64/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_aarch64.sh -CMD /build/build_aarch64.sh diff --git a/recipes/nmap/linux_aarch64/build_aarch64.sh b/recipes/nmap/linux_aarch64/build_aarch64.sh deleted file mode 100644 index 94908dc..0000000 --- a/recipes/nmap/linux_aarch64/build_aarch64.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/openssl" ];then - git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl - fi - if [ ! -d "/build/nmap" ];then - git clone https://github.com/nmap/nmap.git /build/nmap - fi - NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD) -} - -build_musl_aarch64() { - cd /build/musl - git clean -fdx - echo "ARCH=arm64" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - echo "TRIPLE=aarch64-linux-musleabi" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross aarch64" -} - -build_openssl_aarch64() { - cd /build/openssl - git clean -fdx - make clean - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static' ./Configure no-shared linux-generic64 - make -j4 - echo "[+] Finished building OpenSSL aarch64" -} - -build_nmap_aarch64() { - cd /build/nmap - git clean -fdx - make clean - cd /build/nmap/libz - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld . - make zlibstatic - cd /build/nmap - CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \ - CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \ - CXXFLAGS="-I/build/nmap/libz" \ - LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \ - LDFLAGS="-L/build/openssl -L/build/nmap/libz" \ - ./configure \ - --host=aarch64-none-linux-gnueabi \ - --without-ndiff \ - --without-zenmap \ - --without-nmap-update \ - --without-libssh2 \ - --with-pcap=linux \ - --with-libz=/build/nmap/libz \ - --with-openssl=/build/openssl \ - --with-liblua=included - sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile - sed -i 's|LIBS = |& libz/libz.a |' Makefile - make -j4 - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap armhf failed!" - exit 1 - fi - if [ -f "/build/nmap/nmap" -a -f "/build/nmap/ncat/ncat" -a -f "/build/nmap/nping/nping" ];then - /opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-strip nmap ncat/ncat nping/nping - fi -} - -build_aarch64(){ - OUT_DIR_AARCH64=/output/`uname | tr 'A-Z' 'a-z'`/aarch64 - mkdir -p $OUT_DIR_AARCH64 - build_musl_aarch64 - build_openssl_aarch64 - build_nmap_aarch64 - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap aarch64 failed!" - exit 1 - fi - cp /build/nmap/nmap "${OUT_DIR_AARCH64}/nmap-${NMAP_COMMIT}" - cp /build/nmap/ncat/ncat "${OUT_DIR_AARCH64}/ncat-${NMAP_COMMIT}" - cp /build/nmap/nping/nping "${OUT_DIR_AARCH64}/nping-${NMAP_COMMIT}" - echo "[+] Finished building Nmap aarch64" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_aarch64 -} - -main diff --git a/recipes/nmap/linux_armhf/Dockerfile b/recipes/nmap/linux_armhf/Dockerfile deleted file mode 100644 index 2a3103c..0000000 --- a/recipes/nmap/linux_armhf/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_armhf.sh -CMD /build/build_armhf.sh diff --git a/recipes/nmap/linux_armhf/build_armhf.sh b/recipes/nmap/linux_armhf/build_armhf.sh deleted file mode 100644 index 49c1b78..0000000 --- a/recipes/nmap/linux_armhf/build_armhf.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/openssl" ];then - git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl - fi - if [ ! -d "/build/nmap" ];then - git clone https://github.com/nmap/nmap.git /build/nmap - fi - NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD) -} - -build_musl_armhf() { - cd /build/musl - git clean -fdx - echo "ARCH=arm" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - echo "TRIPLE=arm-linux-musleabihf" >> config.sh - echo "GCC_BOOTSTRAP_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh - echo "GCC_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross armhf" -} - -build_openssl_armhf() { - cd /build/openssl - git clean -fdx - make clean - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static' ./Configure no-shared linux-generic32 - make -j4 - echo "[+] Finished building OpenSSL armhf" -} - -build_nmap_armhf() { - cd /build/nmap - git clean -fdx - make clean - cd /build/nmap/libz - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld . - make zlibstatic - cd /build/nmap - CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \ - CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \ - CXXFLAGS="-I/build/nmap/libz" \ - LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \ - LDFLAGS="-L/build/openssl -L/build/nmap/libz" \ - ./configure \ - --host=arm-none-linux-gnueabi \ - --without-ndiff \ - --without-zenmap \ - --without-nmap-update \ - --without-libssh2 \ - --with-pcap=linux \ - --with-libz=/build/nmap/libz \ - --with-openssl=/build/openssl \ - --with-liblua=included - sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile - sed -i 's|LIBS = |& libz/libz.a |' Makefile - make -j4 - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap armhf failed!" - exit 1 - fi - if [ -f "/build/nmap/nmap" -a -f "/build/nmap/ncat/ncat" -a -f "/build/nmap/nping/nping" ];then - /opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-strip nmap ncat/ncat nping/nping - fi -} - -build_armhf(){ - OUT_DIR_ARMHF=/output/`uname | tr 'A-Z' 'a-z'`/armhf - mkdir -p $OUT_DIR_ARMHF - build_musl_armhf - build_openssl_armhf - build_nmap_armhf - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap armhf failed!" - exit 1 - fi - cp /build/nmap/nmap "${OUT_DIR_ARMHF}/nmap-${NMAP_COMMIT}" - cp /build/nmap/ncat/ncat "${OUT_DIR_ARMHF}/ncat-${NMAP_COMMIT}" - cp /build/nmap/nping/nping "${OUT_DIR_ARMHF}/nping-${NMAP_COMMIT}" - echo "[+] Finished building Nmap armhf" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_armhf -} - -main diff --git a/recipes/nmap/linux_x86/Dockerfile b/recipes/nmap/linux_x86/Dockerfile deleted file mode 100644 index 4a1d5cc..0000000 --- a/recipes/nmap/linux_x86/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_x86.sh -CMD /build/build_x86.sh diff --git a/recipes/nmap/linux_x86/build_x86.sh b/recipes/nmap/linux_x86/build_x86.sh deleted file mode 100644 index 86f0acf..0000000 --- a/recipes/nmap/linux_x86/build_x86.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/openssl" ];then - git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl - fi - if [ ! -d "/build/nmap" ];then - git clone https://github.com/nmap/nmap.git /build/nmap - fi - NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD) -} - -build_musl_x86() { - cd /build/musl - git clean -fdx - echo "ARCH=i486" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross x86" -} - -build_openssl_x86() { - cd /build/openssl - git clean -fdx - make clean - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' ./Configure no-shared -m32 linux-generic32 - make -j4 - echo "[+] Finished building OpenSSL x86" -} - -build_nmap_x86() { - cd /build/nmap - git clean -fdx - make clean - cd /build/nmap/libz - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld . - make zlibstatic - cd /build/nmap - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - CXXFLAGS="-I/build/nmap/libz" \ - LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \ - LDFLAGS="-L/build/openssl -L/build/nmap/libz" \ - ./configure \ - --without-ndiff \ - --without-zenmap \ - --without-nmap-update \ - --without-libssh2 \ - --with-pcap=linux \ - --with-libz=/build/nmap/libz \ - --with-openssl=/build/openssl - - sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile - sed -i 's|LIBS = |& libz/libz.a |' Makefile - make -j4 - /opt/cross/i486-linux-musl/bin/i486-linux-musl-strip nmap ncat/ncat nping/nping -} - -build_x86(){ - OUT_DIR_x86=/output/`uname | tr 'A-Z' 'a-z'`/x86 - mkdir -p $OUT_DIR_x86 - build_musl_x86 - build_openssl_x86 - build_nmap_x86 - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap x86 failed!" - exit 1 - fi - NMAP_VERSION=$(/build/nmap/nmap --version |grep "Nmap version" | awk '{print $3}') - NCAT_VERSION=$(/build/nmap/ncat/ncat --version 2>&1 |grep "Ncat: Version" | awk '{print $3}') - NPING_VERSION=$(/build/nmap/nping/nping --version |grep "Nping version" | awk '{print $3}') - cp /build/nmap/nmap "${OUT_DIR_x86}/nmap-${NMAP_VERSION}-${NMAP_COMMIT}" - cp /build/nmap/ncat/ncat "${OUT_DIR_x86}/ncat-${NCAT_VERSION}-${NMAP_COMMIT}" - cp /build/nmap/nping/nping "${OUT_DIR_x86}/nping-${NPING_VERSION}-${NMAP_COMMIT}" - echo "[+] Finished building x86" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_x86 - NMAP_DIR=/output/nmap-data-${NPING_VERSION}-${NMAP_COMMIT} - if [ ! -d "$NMAP_DIR" ];then - echo "[-] ${NMAP_DIR} does not exist, creating it" - mkdir -p "${NMAP_DIR}" - fi - if [ -n "$(ls $NMAP_DIR)" ];then - echo "[+] Data directory is not empty" - exit - fi - cd /build/nmap - make install - cp -r /usr/local/share/nmap/* $NMAP_DIR - echo "[+] Copied data to data dir" -} - -main diff --git a/recipes/nmap/linux_x86_64/Dockerfile b/recipes/nmap/linux_x86_64/Dockerfile deleted file mode 100644 index 848703c..0000000 --- a/recipes/nmap/linux_x86_64/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:xenial -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - cmake \ - build-essential \ - checkinstall \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python -RUN mkdir /build -ADD . /build -RUN chmod +x /build/build_x86_64.sh -CMD /build/build_x86_64.sh diff --git a/recipes/nmap/linux_x86_64/build_x86_64.sh b/recipes/nmap/linux_x86_64/build_x86_64.sh deleted file mode 100644 index 0b28b19..0000000 --- a/recipes/nmap/linux_x86_64/build_x86_64.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash -#set -e -set -o pipefail -set -x -NMAP_COMMIT= - -fetch(){ - if [ ! -d "/build/musl" ];then - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - fi - if [ ! -d "/build/openssl" ];then - git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl - fi - if [ ! -d "/build/nmap" ];then - git clone https://github.com/nmap/nmap.git /build/nmap - fi - NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD) -} - -build_musl() { - cd /build/musl - git clean -fdx - ./build.sh - echo "[+] Finished building musl-cross x86_64" -} - -build_openssl() { - cd /build/openssl - git clean -fdx - make clean - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' ./Configure no-shared linux-x86_64 - make -j4 - echo "[+] Finished building OpenSSL x86_64" -} - -build_nmap() { - cd /build/nmap - git clean -fdx - make clean - cd /build/nmap/libz - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld . - make zlibstatic - cd /build/nmap - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \ - CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \ - CXXFLAGS="-I/build/nmap/libz" \ - LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \ - LDFLAGS="-L/build/openssl -L/build/nmap/libz" \ - ./configure \ - --without-ndiff \ - --without-zenmap \ - --without-nmap-update \ - --without-libssh2 \ - --with-pcap=linux \ - --with-libz=/build/nmap/libz \ - --with-openssl=/build/openssl - - sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile - sed -i 's|LIBS = |& libz/libz.a |' Makefile - make -j4 - /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip nmap ncat/ncat nping/nping -} - -build_x86_64(){ - OUT_DIR_x86_64=/output/`uname | tr 'A-Z' 'a-z'`/x86_64 - mkdir -p $OUT_DIR_x86_64 - build_musl - build_openssl - build_nmap - if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then - echo "[-] Building Nmap x86_64 failed!" - exit 1 - fi - NMAP_VERSION=$(/build/nmap/nmap --version |grep "Nmap version" | awk '{print $3}') - NCAT_VERSION=$(/build/nmap/ncat/ncat --version 2>&1 |grep "Ncat: Version" | awk '{print $3}') - NPING_VERSION=$(/build/nmap/nping/nping --version |grep "Nping version" | awk '{print $3}') - cp /build/nmap/nmap "${OUT_DIR_x86_64}/nmap-${NMAP_VERSION}-${NMAP_COMMIT}" - cp /build/nmap/ncat/ncat "${OUT_DIR_x86_64}/ncat-${NCAT_VERSION}-${NMAP_COMMIT}" - cp /build/nmap/nping/nping "${OUT_DIR_x86_64}/nping-${NPING_VERSION}-${NMAP_COMMIT}" - echo "[+] Finished building x86_64" -} - -main() { - if [ ! -d "/output" ];then - echo "[-] /output does not exist, creating it" - mkdir /output - fi - fetch - build_x86_64 - NMAP_DIR=/output/nmap-data-${NPING_VERSION}-${NMAP_COMMIT} - if [ ! -d "$NMAP_DIR" ];then - echo "[-] ${NMAP_DIR} does not exist, creating it" - mkdir -p "${NMAP_DIR}" - fi - if [ -n "$(ls $NMAP_DIR)" ];then - echo "[+] Data directory is not empty" - exit - fi - cd /build/nmap - make install - cp -r /usr/local/share/nmap/* $NMAP_DIR - echo "[+] Copied data to data dir" -} - -main diff --git a/recipes/socat/Dockerfile b/recipes/socat/Dockerfile deleted file mode 100644 index 87dd49c..0000000 --- a/recipes/socat/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:zesty -RUN apt-get update && \ - apt upgrade -yy && \ - apt install -yy \ - automake \ - autoconf \ - yodl \ - build-essential \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - git \ - pkg-config \ - python -RUN mkdir /build -ADD . /build -CMD /build/build.sh \ No newline at end of file diff --git a/recipes/socat/build.sh b/recipes/socat/build.sh deleted file mode 100644 index a0d06cc..0000000 --- a/recipes/socat/build.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash -set -e -set -x -set -o pipefail - -fetch(){ - #git clone https://github.com/GregorR/musl-cross.git /build/musl - git clone https://github.com/takeshixx/musl-cross.git /build/musl - git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl - git clone https://git.savannah.gnu.org/git/readline.git /build/readline - git clone https://github.com/mirror/ncurses.git /build/ncurses - git clone http://repo.or.cz/socat.git /build/socat -} - -build_musl() { - cd /build/musl - git clean -fdx - ./build.sh - echo "[+] Finished building musl-cross x86_64" -} - -build_musl_x86() { - cd /build/musl - git clean -fdx - echo "ARCH=i486" >> config.sh - echo "GCC_BUILTIN_PREREQS=yes" >> config.sh - ./build.sh - echo "[+] Finished building musl-cross x86" -} - -build_openssl() { - cd /build/openssl - git clean -fdx - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' ./Configure no-shared linux-x86_64 - make - echo "[+] Finished building OpenSSL x86_64" -} - -build_openssl_x86() { - cd /build/openssl - git clean -fdx - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' ./Configure no-shared -m32 linux-generic32 - make - echo "[+] Finished building OpenSSL x86" -} - -build_ncurses() { - cd /build/ncurses - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \ - --disable-shared \ - --enable-static - echo "[+] Finished building ncurses x86_64" -} - -build_ncurses_x86() { - cd /build/ncurses - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \ - --disable-shared \ - --enable-static - echo "[+] Finished building ncurses x86" -} - -build_readline() { - cd /build/readline - git clean -fdx - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \ - --disable-shared \ - --enable-static - make -j4 - echo "[+] Finished building readline x86_64" -} - -build_readline_x86() { - cd /build/readline - git clean -fdx - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \ - --disable-shared \ - --enable-static - make -j4 - echo "[+] Finished building readline x86" -} - -build_socat() { - cd /build/socat - git clean -fdx - autoconf - CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' \ - CFLAGS='-fPIC' \ - CPPFLAGS='-I/build -I/build/openssl/include -DNETDB_INTERNAL=-1' \ - LDFLAGS="-L/build/readline -L/build/ncurses/lib -L/build/openssl" \ - ./configure - make -j4 - /opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip socat -} - -build_socat_x86() { - cd /build/socat - git clean -fdx - autoconf - CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' \ - CFLAGS='-fPIC' \ - CPPFLAGS='-I/build -I/build/openssl/include -DNETDB_INTERNAL=-1' \ - LDFLAGS="-L/build/readline -L/build/ncurses/lib -L/build/openssl" \ - ./configure - make -j4 - /opt/cross/i486-linux-musl/bin/i486-linux-musl-strip socat -} - -main() { - if [ ! -d /output ];then - echo "[-] /output does not exist" - exit - fi - fetch - - build_musl - build_openssl - build_ncurses - build_readline - build_socat - - OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86_64 - mkdir -p $OUT_DIR - cp /build/socat/socat $OUT_DIR/ - echo "[+] Finished building socat x86_64" - - build_musl_x86 - build_openssl_x86 - build_ncurses_x86 - build_readline_x86 - build_socat_x86 - - OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86 - mkdir -p $OUT_DIR - cp /build/socat/socat $OUT_DIR/ - echo "[+] Finished building socat x86" -} - -main