3 ###############################
4 # Copyright (C) 2012 shibby
6 # This script send anonymous or incompleted information about model of router and installed tomato version.
7 # Those information will be used ONLY for stats.
8 # Any of private information will be NOT sended!
9 # Results you can explore on http://tomato.groov.pl/tomatoanon.php page.
10 # If you don`t agree to run this script you can set nvram variable tomatoanon to 0.
13 # - MD5SUM of WAN+LAN MAC addresses - this will identify a router. Ex: 1c1dbd4202d794251ec1acf1211bb2c8
14 # - Model of router. Ex: Asus RT-N66U
15 # - Version of installed tomato. Ex: 102 K26 USB
16 # - Builtype. Ex: Mega-VPN-64K
17 # - Country. Ex: POLAND
18 # - ISO Country code. Ex: PL
19 # - Uptime of your router. Ex: 3 days
22 ###############################
24 ANON_ENABLED
=`nvram get tomatoanon_enable`
25 ANON_ANSWER
=`nvram get tomatoanon_answer`
27 if [ "$ANON_ANSWER" == "1" ]; then
28 if [ "$ANON_ENABLED" == "1" ]; then
32 UPTIME
=`uptime | cut -d "," -f1 | cut -d " " -f4,5`
33 WANMAC
=`nvram get wan_hwaddr`
34 LANMAC
=`nvram get lan_hwaddr`
35 MODEL
=`nvram get t_model_name`
36 WANMAC_MD5
=`echo "$WANMAC+$LANMAC" | md5sum | cut -d " " -f1`
38 ROUTERID
=`nvram get tomatoanon_id`
39 if [ ! "$ROUTERID" == "$WANMAC_MD5"]; then
40 nvram
set tomatoanon_id
="$WANMAC_MD5"
44 #Detect Version and Buildtype
45 KERNEL
=`uname -r | cut -d "." -f1,2`
46 if [ "$KERNEL" == "2.6" ]; then
47 IS_USB
=`nvram get os_version | grep USB | wc -l`
48 if [ "$IS_USB" == "0" ]; then #if K26
49 VER
=`nvram get os_version | cut -d "-" -f2,3,4,5,6,7,8 | cut -d " " -f1,2`
50 BUILDTYPE
=`nvram get os_version | cut -d "-" -f2,3,4,5,6,7,8 | cut -d " " -f3,4,5`
52 VER
=`nvram get os_version | cut -d "-" -f2,3,4,5,6,7,8 | cut -d " " -f1,2,3`
53 BUILDTYPE
=`nvram get os_version | cut -d "-" -f2,3,4,5,6,7,8 | cut -d " " -f4,5,6`
56 IS_USB
=`nvram get os_version | grep USB | wc -l`
57 if [ "$IS_USB" == "0" ]; then #if K24
58 VER
=`nvram get os_version | cut -d " " -f2,3`
59 BUILDTYPE
=`nvram get os_version | cut -d " " -f4,5`
61 VER
=`nvram get os_version | cut -d " " -f2,3,4`
62 BUILDTYPE
=`nvram get os_version | cut -d " " -f5,6`
66 #Get country name and code
67 wget
-O /tmp
/country http
://api.easyjquery.com
/test
/demo-ip.php
68 ISO
=`cat /tmp/country | grep Country] | cut -d " " -f7`
69 COUNTRY
=`cat /tmp/country | grep CountryName | cut -d " " -f7`
72 #Change all spaces to %20.
73 echo "http://tomato.groov.pl/tomatoanon.php?wanmac_md5=$WANMAC_MD5&model=$MODEL&version=$VER&buildtype=$BUILDTYPE&country=$COUNTRY&flag=$ISO&uptime=$UPTIME&mod=$MOD&anon=1" > /tmp
/AnonLink
74 sed -i "s/ /%20/g" /tmp
/AnonLink
75 ANONSEND
=`cat /tmp/AnonLink`
78 #We have all we need well we can send datas to Anon database
79 wget
-O /dev
/null
$ANONSEND
83 INTERVAL
=`nvram get tomatoanon_cru`
85 cru a tomatoanon
"* */$INTERVAL * * * /usr/bin/tomatoanon"
87 else #if anon is not enabled or was disabled right now
89 ISCRU
=`cru l | grep tomatoanon | wc -l`
90 if [ "$ISCRU" == "0" ]; then
96 else #if answer is not enabled or was disabled right now
98 ISCRU
=`cru l | grep tomatoanon | wc -l`
99 if [ "$ISCRU" == "0" ]; then