Skip to content

Instantly share code, notes, and snippets.

@creaktive
Created January 16, 2011 14:01
Show Gist options
  • Save creaktive/781805 to your computer and use it in GitHub Desktop.
Save creaktive/781805 to your computer and use it in GitHub Desktop.
random.org sampling via Tor
#!/bin/bash
AGENT="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"
RANDOMORG="http://www.random.org/integers/?num=10000&min=0&max=65535&col=2&base=16&format=plain&rnd=new"
SESSION=`date +%Y%m%d%H%M%S`
for i in {1..100}
do
echo "#${i}"
echo -ne "AUTHENTICATE\r\nsignal NEWNYM\r\nquit\r\n" | nc localhost 9051 > /dev/null
curl -A "${AGENT}" -f -v --socks4a localhost:9050 "${RANDOMORG}&n=[1-3]" | perl -ne 'print pack("SS", hex $1, hex $2) if /^([0-9a-f]+)\s+([0-9a-f]+)/i' >> "${SESSION}.rnd"
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment