Skip to content

Build Masscan Binaries #57

Build Masscan Binaries

Build Masscan Binaries #57

name: Build Masscan Binaries
on:
workflow_dispatch:
schedule:
- cron: "0 20 * * 6" # 08:00 PM UTC Every Saturday --> 01:45 AM Nepal Time Every Sunday
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none" #https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
- name: Install build dependencies
run: "\
sudo apt-get update\n
sudo apt-get install -y --no-install-recommends bison build-essential ca-certificates flex file pkg-config qemu-system qemu-user qemu-user-static wget \n"
- name: Setup Env
run: |
# Create Output Dir
mkdir -p "$GITHUB_WORKSPACE/main/masscan"
- name: Build --> linux-arm64-aarch64-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/robertdavidgraham/masscan
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -s -static/' "./masscan/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-arm64 bash -c "git config --global --add safe.directory /work/masscan ; cd ./masscan && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/masscan && ./bin/masscan --help ; echo"
# Move Bin
mv ./masscan/bin/masscan "$GITHUB_WORKSPACE/main/masscan/masscan_linux_arm64_aarch64_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
#continue-on-error: true
- name: Build --> linux-arm64-aarch64-musl
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/robertdavidgraham/masscan
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -s -static/' "./masscan/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-arm64-musl bash -c "git config --global --add safe.directory /work/masscan ; cd ./masscan && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/masscan && ./bin/masscan --help ; echo"
mv ./masscan/bin/masscan "$GITHUB_WORKSPACE/main/masscan/masscan_linux_arm64_aarch64_musl"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
#continue-on-error: true
- name: Build --> linux-x86-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/robertdavidgraham/masscan
# Add static flag
sed -i 's/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -s -static/' "./masscan/Makefile"
docker run --privileged -v $(pwd):/work dockcross/linux-x86 bash -c "git config --global --add safe.directory /work/masscan ; cd ./masscan && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/masscan && ./bin/masscan --help ; echo"
mv ./masscan/bin/masscan "$GITHUB_WORKSPACE/main/masscan/masscan_linux_x86_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
#continue-on-error: true
- name: Build --> linux-x86-64-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/robertdavidgraham/masscan
# Add static flag
sed -i 's/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -s -static/' "./masscan/Makefile"
docker run --privileged -v $(pwd):/work dockcross/linux-x64 bash -c "git config --global --add safe.directory /work/masscan ; cd ./masscan && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/masscan && ./bin/masscan --help ; echo"
mv ./masscan/bin/masscan "$GITHUB_WORKSPACE/main/masscan/masscan_linux_x86_64_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
#continue-on-error: true
- name: Build --> linux-s390x-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/robertdavidgraham/masscan
# Add static flag
sed -i 's/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2/CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -s -static/' "./masscan/Makefile"
docker run --privileged -v $(pwd):/work dockcross/linux-s390x bash -c "git config --global --add safe.directory /work/masscan ; cd ./masscan && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/masscan && ./bin/masscan --help ; echo"
mv ./masscan/bin/masscan "$GITHUB_WORKSPACE/main/masscan/masscan_linux_s390x_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
#continue-on-error: true
- name: Update README.md
run: |
cd "$GITHUB_WORKSPACE/main"
cat ./masscan/INFO.md > ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo '---' >> ./masscan/README.md
echo '```console' >> ./masscan/README.md
/bin/bash -c 'PS4="$ "; set -x; file ./masscan/masscan_*' &>> ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo -e "--> SHA256SUM" >> ./masscan/README.md
/bin/bash -c 'PS4="$ "; set -x; sha256sum ./masscan/masscan_*' &>> ./masscan/README.md
echo -e '```\n' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo '---' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo '- #### Sizes' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo '```console' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
/bin/bash -c 'PS4="$ ";ls -lh ./masscan | awk "{print \$5, \$9}" | column -t' &>> ./masscan/README.md
echo '```' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
echo '---' >> ./masscan/README.md
echo -e "" >> ./masscan/README.md
working-directory: main
continue-on-error: true
- name: Git Pull
run: |
cd "$GITHUB_WORKSPACE/main" && git pull origin main
continue-on-error: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas # defaults to "github-actions[bot]"
commit_user_email: AjamX101@gmail.com # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
commit_message: Cross-Compile Masscan Binaries
#push_options: '--force'