Last active
May 7, 2016 12:17
-
-
Save ChrisMorrisOrg/8bd16d602b6f710a1ea69d7e43d5630a to your computer and use it in GitHub Desktop.
Download every zine from Phrack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Download every zine from Phrack | |
COUNTER=1 | |
while [ $COUNTER -ne -1 ]; do | |
FILE="phrack$COUNTER.tar.gz" | |
URL="http://phrack.org/archives/tgz/$FILE" | |
if [ ! -f $FILE ] && [ ! -d $COUNTER ]; then | |
exists=`wget -S --spider $URL 2>&1 | grep '200 OK'` | |
if [[ $exists ]]; then | |
echo "Downloading Phrack #$COUNTER $URL" | |
wget -q $URL | |
mkdir $COUNTER 2>/dev/null && tar xvzf $FILE -C $COUNTER 2>/dev/null | |
rm $FILE 2>/dev/null | |
let COUNTER=$COUNTER+1 | |
else | |
echo "Completely phracked!" | |
let COUNTER=-1 | |
fi | |
else | |
echo "Already Downloaded: $URL" | |
let COUNTER=$COUNTER+1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment