Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh -ex
# https://collector.torproject.org/archive/relay-descriptors/server-descriptors/server-descriptors-YYYY-MM.tar.xz
basename=`basename "$1" .tar.xz`
test -d "$basename" || tar xJf "$1"
grep -Elr '^router .* (50\.7|204\.45)\.' "$basename" > "$basename.descriptors"
xargs grep -l '^router Unnamed ' < "$basename.descriptors" > "$basename.descriptors.unnamed"
xargs grep -l '^platform Tor 0\.2\.4\.18-rc' < "$basename.descriptors.unnamed" > "$basename.descriptors.unnamed-v18"
xargs grep -h '^fingerprint ' < "$basename.descriptors.unnamed-v18" |
cut -d ' ' -f 2- | tr -d ' ' |
sort -u > "$basename.fingerprints.unnamed-v18"
xargs grep -h '^router ' < "$basename.descriptors.unnamed-v18" |
cut -d ' ' -f 3 |
sort -u > "$basename.ipaddresses.unnamed-v18"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.