Skip to content

Instantly share code, notes, and snippets.

@dzogrim
Last active February 15, 2019 21:32
Show Gist options
  • Select an option

  • Save dzogrim/fda3847da117f04bbcbaa65d9dc9cc0a to your computer and use it in GitHub Desktop.

Select an option

Save dzogrim/fda3847da117f04bbcbaa65d9dc9cc0a to your computer and use it in GitHub Desktop.
Download all excellent Objective-See products from Patrick Wardle
#!/bin/bash
base_URL="https://objective-see.com/products.html"
dest_DIR="${HOME}/Downloads"
file_EXT="zip"
installers=(BlockBlock DoNotDisturb LuLu OverSight RansomWhere ReiKey WhatsYourSign)
[[ ! -d "${dest_DIR}" ]] && exit 1
[[ ! "$( which curl )" ]] && exit 1
elementIn () {
shopt -s nocasematch
local e
for e in "${@:2}"; do
[[ "$1" =~ "${e}"* ]] && return 0
done
return 1
}
mkdir -p ${dest_DIR}/Objective-See/Applications
mkdir -p ${dest_DIR}/Objective-See/Installers
curl "${base_URL}" -s | grep -i "${file_EXT}" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" \
| sort | uniq | while read line ; do
file_VAR=${line##*/}
if elementIn "$file_VAR" "${installers[@]}" ; then
last_DIR="${dest_DIR}/Objective-See/Installers"
else
last_DIR="${dest_DIR}/Objective-See/Applications"
fi
echo "Downloading ${file_VAR} in ${last_DIR}..."
curl -L -s "${line}" -o "${last_DIR}/${file_VAR}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment