diff options
Diffstat (limited to 'download-phrack-targz.sh')
-rwxr-xr-x | download-phrack-targz.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/download-phrack-targz.sh b/download-phrack-targz.sh new file mode 100755 index 0000000..6ec9c01 --- /dev/null +++ b/download-phrack-targz.sh @@ -0,0 +1,25 @@ +#!/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 |