[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [torflow/master 90/92] snakeinspector: Only print finished results when filtering by finishedafter or finishedbefore



Author: John M. Schanck <john@xxxxxxxxxxx>
Date: Fri, 20 Aug 2010 16:49:45 -0400
Subject: snakeinspector: Only print finished results when filtering by finishedafter or finishedbefore
Commit: 52f75c96dc21c3e2fd28cdc59cda1c20a0ecbd49

---
 NetworkScanners/ExitAuthority/snakeinspector.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/NetworkScanners/ExitAuthority/snakeinspector.py b/NetworkScanners/ExitAuthority/snakeinspector.py
index 471c49a..aac8c11 100755
--- a/NetworkScanners/ExitAuthority/snakeinspector.py
+++ b/NetworkScanners/ExitAuthority/snakeinspector.py
@@ -65,6 +65,7 @@ class SIConf(object):
     self.after = 0
     self.finishedbefore = 0xffffffff
     self.finishedafter = 0
+    self.finished = False
     self.sortby="proto"
     self.siterate = 100
     self.exitrate = 0
@@ -101,8 +102,10 @@ class SIConf(object):
         self.before = time.mktime(time.strptime(a))
       elif o == '--finishedbefore':
         self.finishedbefore = time.mktime(time.strptime(a))
+        self.finished = True
       elif o == '--finishedafter':
         self.finishedafter = time.mktime(time.strptime(a))
+        self.finished = True
       elif o == '-t' or o == '--resultfilter':
         self.resultfilter = a
       elif o == '-p' or o == '--proto':
@@ -200,8 +203,10 @@ def main(argv):
     if r.reason in conf.noreasons: continue
     if conf.reasons and r.reason not in conf.reasons: continue
     if r.timestamp < conf.after or conf.before < r.timestamp: continue
-    if r.finish_timestamp and r.finish_timestamp < conf.finishedafter: continue
-    if r.finish_timestamp and conf.finishedbefore < r.finish_timestamp: continue
+    if conf.finished:
+      if not r.finish_timestamp: continue
+      if r.finish_timestamp < conf.finishedafter: continue
+      if conf.finishedbefore < r.finish_timestamp: continue
     if (conf.falsepositives) ^ r.false_positive: continue
     if conf.confirmed != r.confirmed: continue
     if r.site_result_rate[1] != 0 and \
-- 
1.7.1