[or-cvs] r22189: {projects} Fix MakeStat script so that it works with recent versions of (projects/gettor)

Christian Fromme kaner at strace.org
Fri Apr 16 08:52:06 UTC 2010


Author: kaner
Date: 2010-04-16 08:52:06 +0000 (Fri, 16 Apr 2010)
New Revision: 22189

Modified:
   projects/gettor/MakeStat.py
Log:
Fix MakeStat script so that it works with recent versions of GetTor


Modified: projects/gettor/MakeStat.py
===================================================================
--- projects/gettor/MakeStat.py	2010-04-15 18:47:54 UTC (rev 22188)
+++ projects/gettor/MakeStat.py	2010-04-16 08:52:06 UTC (rev 22189)
@@ -52,7 +52,7 @@
         sys.exit(1)
     readData = logFile.read().split('\n')
     for line in readData:
-        match = re.match(".*Request from.*", line, re.DOTALL)
+        match = re.match(".*Request from.*cmdaddr None.*", line, re.DOTALL)
         if match:
             splitline = string.split(line)
             if len(splitline) > 12:
@@ -71,6 +71,26 @@
                     if pack in packs:
                         packs[pack] += 1
                 days[day] = packs
+        else:
+            match = re.match(".*Request From.*Cmdaddr: None.*", line, re.DOTALL)
+            if match:
+                splitline = string.split(line)
+                if len(splitline) > 12:
+                    day = splitline[0]
+                    pack = splitline[9]
+                    lang = splitline[11]
+                    if not re.match("[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]", day):
+                        continue
+                    pack = pack.strip(',')
+                    lang = lang.strip(',')
+                    if day in days:
+                        packs = days[day]
+                    else:
+                        packs = emptyPacks(packages).copy()
+                    if pack is not None:
+                        if pack in packs:
+                            packs[pack] += 1
+                    days[day] = packs
 
 def printStatsStdout(days):
     for day in sorted(days.iterkeys()):



More information about the tor-commits mailing list