#!/bin/bash if ! command -v curl &>/dev/null; then printf "%s\n" "[err] curl not found" exit 1 fi archives=$(curl -sSLf https://archives.phrack.org/tgz/ | grep -oP '(?<=phrack)[0-9]{1,}(?=\.tar\.gz)' | sort -n | tail -1) if ! test "${archives}"; then printf "%s\n" "[err] failed to get phrack archives" exit 1 fi for ((i=1; i<=archives; i++)); do remote_file="phrack${i}.tar.gz" if (( i < 10 )); then local_file="phrack0${i}.tar.gz" else local_file="${remote_file}" fi url="http://phrack.org/archives/tgz/${remote_file}" printf "%s\n" "[inf] downloading ${url}" curl -sSLf "${url}" -o "${local_file}" done