Ticket #13504: check-bundled-bridges-are-public.sh

File check-bundled-bridges-are-public.sh, 992 bytes (added by isis, 6 years ago)
Line 
1#!/bin/bash
2
3git log -p -- \
4    Bundle-Data/PTConfigs/bridge_prefs.js Bundle-Data/beta/bridge_prefs.js | \
5    grep [-+]pref | cut -d ' ' -f 2- | sed -e 's/");//' | sed -e 's/"//' | \
6    sort | uniq | \
7    sed -e 's/fte [a-z].*//' | \
8    sed -re  's/^(flashproxy|meek).*//' | \
9    sed -e 's/^obfs3$//' > bundled-bridges.txt
10
11if ! test -f "bundled-bridges-details" ; then
12    torsocks curl -o bundled-bridges-details \
13        "https://onionoo.torproject.org/details?type=bridge&fields=hashed_fingerprint"
14fi
15
16for fpr in `cat bundled-bridges.txt | cut -d ' ' -f 3-3 | sort | uniq`; do
17    hashedfpr=`python3 -c "import hashlib,binascii;print(hashlib.sha1(binascii.a2b_hex('$fpr')).hexdigest().upper());"`
18    public=`grep -i $hashedfpr bundled-bridges-details`
19    bridgeline=`grep -i $fpr bundled-bridges.txt`
20    printf "%s\n" "$bridgeline"
21    printf "%s -> %s" "$fpr" "$hashedfpr "
22    if test -n "$public" ; then
23        printf "yes\n\n"
24    else
25        printf "no\n\n"
26    fi
27done