Gonna dump my own shit in here. Maybe someone would ever need that.
An AWK script to check TOR bridges.
Expects ip as the third field, change $3 to $2 if IP is the second.
BEGIN
{
srand();
}
{
split($3, host, ":");
bytes = int(rand() * 10) + 1;
data = ("dd if=/dev/urandom bs=1 count=" bytes " 2>/dev/null");
r = system(data "|nc " host[1] " " host[2]);
if (! r) print;
}
An AWK script that will look up your bridges in the Tor`s own GeoIP database.
Points of interest:
$3 at the last clause stands for IP.
TOR_GEOIP = "/usr/share/tor/geoip" may be changed.
function int_to_ip(n)
{
if (n == 0) return;
prev = int_to_ip(rshift(n,8));
return (prev) (prev ? "." : "") n % 256;
}
function ip_to_int(ip)
{
split(ip, parts, ".");
return parts[1] * 16777216 + parts[2] * 65536 + parts[3] * 256 + parts[4];
}
function ipn_lookup(ip)
{
while (1)
{
stat = getline s