Skip to content

Instantly share code, notes, and snippets.

@conorsch
Created January 6, 2021 20:35
Show Gist options
  • Save conorsch/d7aea8c0b8aedb1a22e8bb2f22009a3c to your computer and use it in GitHub Desktop.
Save conorsch/d7aea8c0b8aedb1a22e8bb2f22009a3c to your computer and use it in GitHub Desktop.
Query SecureDrop v2/v3 stats
#!/bin/bash
# Helper script to query the SecureDrop Directory API,
# and display how many instances are serving Onion v3 URLs.
set -e
set -u
set -o pipefail
onion_info="$(curl -s https://securedrop.org/api/v1/directory/ | python3 -m json.tool | grep -i onion_address)"
printf '%d/%d SecureDrop directory instances use v3 URLs\n' \
"$(echo "$onion_info" | grep -P '\w{25,}.onion' | wc -l)" \
"$(echo "$onion_info" | wc -l)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment