Skip to content

Instantly share code, notes, and snippets.

@nothub
Last active July 21, 2022 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothub/339cff5283dfa29dd543e557884d10b4 to your computer and use it in GitHub Desktop.
Save nothub/339cff5283dfa29dd543e557884d10b4 to your computer and use it in GitHub Desktop.
download and unpack phrack issues
#!/usr/bin/env bash
set -exuo pipefail
latest_issue="70"
curl \
--location \
--remote-name \
--progress-bar \
--retry 10 \
--retry-delay 60 \
--retry-connrefused \
--continue-at - \
http://www.phrack.org/archives/tgz/phrack[1-${latest_issue}].tar.gz
for path in "${PWD}"/*; do
file=$(basename "${path}")
if ! echo "${file}" | grep --quiet --extended-regexp "phrack[0-9]+\.tar\.gz"; then continue; fi
dir="issues/${file//[^0-9]/}"
mkdir -p "${dir}"
tar xvf "${file}" --directory "${dir}"
rm -f "${file}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment