Skip to content

Instantly share code, notes, and snippets.

@DoctorD90
Created January 19, 2017 15:29
Show Gist options
  • Save DoctorD90/762c26e973a00a23abaf3a89e65c330a to your computer and use it in GitHub Desktop.
Save DoctorD90/762c26e973a00a23abaf3a89e65c330a to your computer and use it in GitHub Desktop.
Bash script to download pastes listed on https://haveibeenpwned.com/Pastes/Latest
#!/bin/bash
pastes="$(curl -s https://haveibeenpwned.com/Pastes/Latest | grep http://pastebin.com/ | sed 's/<a href=\"//g' | sed 's/\">//g')"
for link in $pastes; do
mkdir -p haveibeenpwned
echo "Checking $link"
id="$(echo "$link" | sed 's/http:\/\/pastebin.com\///g')"
if [ ! -e ./haveibeenpwned/"$id".txt ]; then
echo "Downloading . . ."
rawlink="$(echo "$link" | sed 's/pastebin.com\//pastebin.com\/raw\//g')"
wget -nv -O ./haveibeenpwned/"$id".txt "$rawlink"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment