#!/bin/sh
# Copyright Michael John Wensley 2005
#
# You can update your IP to country database like this:
# cd /usr/share/GeoIP/
# wget -c http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
# gunzip GeoIP.dat.gz
# wget -c http://www.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
# gunzip GeoIPASNum.dat.gz
#
# Country flags are from the "openclipart" Debian packages.
#
# Link them like in these files:
# http://www.wensley.org.uk/flags/png
# http://www.wensley.org.uk/flags/svg
# Apache content negotiation handles choice of flag,
# as firefox typically fetches PNG, Opera fetches SVG
echo -ne $'Content-Type: application/xhtml+xml; charset=UTF-8\r\n\r\n'
echo -ne $'
GNUnet by Country
Note these are only the IP addresses that my node knows of!
If you need anonymity you are advised to investigate GNUnet\'s F2F features
Rows in sqlite3 table gn070: '
sqlite3 /var/lib/gnunet/data/fs/content/gnunet.dat $'SELECT COUNT(*) FROM gn070'
echo -ne $'
Connected Now on TCP IPv6
'
function hex2dec () {
bc <"
#if [ "`echo $CC | cut -c3`" == "," -a "`echo $CC | cut -c1-2`" != "a1" ]
#then
echo -n " "
#else
# echo -n " "
#fi
echo ""$COUNT" "$CC" "$NAME""
done
}
# Used to check established on source or destination port 2086 or 2088...
# netstat -n --inet | grep tcp[^6] | grep 208[68] | grep ESTABLISHED | cut -d":" -f2 | rev | cut -d" " -f1 | rev | while read
# grep "^.\{39\}082[68]\|^.\{77\}082[68]"
# grep "^.\{15\}082[68]\|^.\{29\}082[68]"
# Instead we now check to see what the GNUnet user has open
GUID=`grep "^gnunet" /etc/passwd | cut -d":" -f3`
cat /proc/net/tcp6 | grep "^.\{82\}01" | grep "^.\{124\}`printf %5d $GUID` " | cut -c45-76 | while read
do
IPV4=$''
IPV6_REGISTRY=$''
export $(ipv6calc -imq $(net2v6 ${REPLY}) | grep -v \")
if [ ${IPV4} != $'' ]
then geoiplookup ${IPV4} | cut -d: -f2
elif [ ${IPV6_REGISTRY} == $'RIPENCC' ]
then echo $'EU, Europe'
else echo $'IP Address not found'
fi
done | sort | uniq --count | sort -r | country
echo -ne $'
Connected Now on TCP IPv4
'
cat /proc/net/tcp | grep "^.\{34\}01" | grep "^.\{76\}`printf %5d $GUID` " | cut -c21-28 | while read
do
if [ $(net2v4 ${REPLY}) != $'127.0.0.1' ]
then
geoiplookup $(net2v4 $REPLY) | cut -d: -f2
fi
done | sort | uniq --count | sort -r | country
cat << EOF
Known Peers
EOF
gnunet-peer-info 2> /dev/null | tr -d \'\` | {
while read N KEY N N TRUST N N ADDR TYPE N
do
CO=1
I=1
case $TYPE in
\(UDP\)) CO=6; I=4 ;;
\(TCP\)) CO=17; I=4 ;;
\(UDP6\)) CO=12; I=6 ;;
\(TCP6\)) CO=23; I=6 ;;
esac
if [ ${I} = $'4' ]
then
IP=$(echo $ADDR | cut -d: -f1)
# echo -ne $KEY"."$CO"\t"
geoiplookup $IP | cut -d: -f2
fi
if [ ${I} = $'6' ]
then
IPV4=$''
IPV6_REGISTRY=$''
IP=$(echo $ADDR | rev | cut -f2- -d: | rev)
export $(ipv6calc -imq $IP | grep -v \")
# echo -ne ${KEY}$'.'${CO}$'\t'
if [ ${IPV4} != $'' ]
then geoiplookup ${IPV4} | cut -d: -f2
elif [ ${IPV6_REGISTRY} == $'RIPENCC' ]
then echo $'EU, Europe'
else echo $'IPv6'
fi
fi
done
} | sort -k3 | uniq --count | sort -r | country
#if [ ! "$PATH_INFO" = "" ]
#then
cat << EOF
Hostlist Fetchers
EOF
for N in /var/log/apache2/gnunet.log
do
case $N in
*gz) zgrep "GET /hostlist" $N
;;
*bz2) bzgrep "GET /hostlist" $N
;;
*) grep "GET /hostlist" $N
;;
esac
done | cut -d" " -f1-2 | grep "^.. " | sort | uniq | \
cut -f1 -d" " | uniq --count | sort -r | country
#fi
cat << EOF
EOF