[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1552: Add a script to build a geoip cache from a Tor network statu (trunk/pkg)
Author: edmanm
Date: 2006-12-25 00:50:12 -0500 (Mon, 25 Dec 2006)
New Revision: 1552
Added:
trunk/pkg/build-geoip-cache.sh
Log:
Add a script to build a geoip cache from a Tor network status. We'll ship a
prebuilt cache with our installers so people don't start out empty handed.
Added: trunk/pkg/build-geoip-cache.sh
===================================================================
--- trunk/pkg/build-geoip-cache.sh (rev 0)
+++ trunk/pkg/build-geoip-cache.sh 2006-12-25 05:50:12 UTC (rev 1552)
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Vidalia is distributed under the following license:
+#
+# Copyright (C) 2006, Matt Edman, Justin Hipple
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#################################################################
+
+DIRURL="http://tor.noreply.org/tor/status/all"
+GEOIPURL="http://geoip.vidalia-project.net/cgi-bin/geoip"
+CACHEFILE="geoip-cache"
+timestamp=$(date -u +%s)
+
+# Fetch a list of server IP addresses
+ipaddrs=$(wget -q -O - "$DIRURL" | awk '$1 == "r" { print $7 }' | sort | uniq | tr "\n" ",")
+
+# Get GeoIP information for each IP address
+geoips=$(wget -q -O - --post-data="ip=$ipaddrs" "$GEOIPURL")
+
+# Cache the GeoIP information with timestamps
+IFS=$'\n'
+rm -f $CACHEFILE
+for geoip in $geoips; do
+ echo "$geoip:$timestamp" >> "$CACHEFILE"
+done
+
Property changes on: trunk/pkg/build-geoip-cache.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id