From 435888e884e6e43a07aa6cfda0a4ba30a59bbdde Mon Sep 17 00:00:00 2001 From: ItsIgnacioPortal <46269721+ItsIgnacioPortal@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:27:53 -0300 Subject: [PATCH] feat(cicd): Added error handling to the etc-files wordlist pipeline --- .bin/etc-files-list-update/util/get-package-urls.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.bin/etc-files-list-update/util/get-package-urls.sh b/.bin/etc-files-list-update/util/get-package-urls.sh index 721c309f4..b5455bf72 100755 --- a/.bin/etc-files-list-update/util/get-package-urls.sh +++ b/.bin/etc-files-list-update/util/get-package-urls.sh @@ -1,10 +1,16 @@ #!/bin/bash +set -euo pipefail # get new package URLs # load the list of amd64 packages from ubuntu export dist="$(cat current_distro)" export repo="http://archive.ubuntu.com/ubuntu" +export url="$repo/dists/$dist/main/binary-amd64/Packages.gz" # print URLs -curl $repo/dists/$dist/main/binary-amd64/Packages.gz | \ - gzip -d | awk '/^Filename: / { print ENVIRON["repo"] "/" $2 }' +if ! data="$(curl -fsSL "$url")"; then + echo "[ERROR] The download of package lists from Ubuntu failed. The URL was: \"$url\". Either the server is down, or it's time to update the distro name in this file: \"SecLists/.bin/etc-files-list-update/current_distro\"" >&2 + exit 1 +fi + +printf '%s' "$data" | gzip -d | awk -v repo="$repo" '/^Filename: / { print repo "/" $2 }' \ No newline at end of file