[or-cvs] [torflow/master 54/92] Snakeinspector arguments to filter by site_ and exit_result_rate
mikeperry at torproject.org
mikeperry at torproject.org
Sat Aug 21 05:14:00 UTC 2010
Author: John M. Schanck <john at anomos.info>
Date: Sun, 1 Aug 2010 12:09:36 -0400
Subject: Snakeinspector arguments to filter by site_ and exit_result_rate
Commit: 66cea0997c22ac22ec320389e1e0ba2b036a52fc
---
NetworkScanners/ExitAuthority/snakeinspector.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/NetworkScanners/ExitAuthority/snakeinspector.py b/NetworkScanners/ExitAuthority/snakeinspector.py
index d3fd676..6a59dd9 100755
--- a/NetworkScanners/ExitAuthority/snakeinspector.py
+++ b/NetworkScanners/ExitAuthority/snakeinspector.py
@@ -39,6 +39,8 @@ def usage(argv):
print " --proto <protocol>"
print " --resultfilter <TestResult class name>"
print " --statuscode <'Failure' or 'Inconclusive'>"
+ print " --siterate <integer n; print result if <n% of exits failed that site>"
+ print " --exitrate <integer n; print result if the exit failed >n% of sites>"
print " --sortby <'proto' or 'url' or 'exit' or 'reason'>"
print " --falsepositives"
print " --verbose"
@@ -59,6 +61,8 @@ class SIConf(object):
self.before = 0xffffffff
self.after = 0
self.sortby="proto"
+ self.siterate = 100
+ self.exitrate = 0
self.falsepositives=False
self.send_email = False
self.confirmed = False
@@ -69,7 +73,7 @@ class SIConf(object):
try:
opts,args = getopt.getopt(argv[1:],"d:f:x:r:n:a:b:t:p:o:s:Fmcv",
["dir=", "file=", "exit=", "reason=", "resultfilter=", "proto=",
- "verbose", "statuscode=", "sortby=",
+ "verbose", "statuscode=", "siterate=", "exitrate=", "sortby=",
"noreason=", "after=", "before=", "falsepositives", "email",
"confirmed"])
except getopt.GetoptError,err:
@@ -94,6 +98,10 @@ class SIConf(object):
self.resultfilter = a
elif o == '-p' or o == '--proto':
self.proto = a
+ elif o == '--siterate':
+ self.siterate = int(a)
+ elif o == '--exitrate':
+ self.exitrate = int(a)
elif o == '-F' or o == '--falsepositives':
self.falsepositives = True
elif o == '-m' or o == '--email':
@@ -165,6 +173,8 @@ def main(argv):
if r.timestamp < conf.after or conf.before < r.timestamp: continue
if (conf.falsepositives) ^ r.false_positive: continue
if conf.confirmed != r.confirmed: continue
+ if r.site_result_rate[1] != 0 and conf.siterate < (100*r.site_result_rate[0]/r.site_result_rate[1]): continue
+ if r.exit_result_rate[1] != 0 and conf.exitrate > (100*r.exit_result_rate[0]/r.exit_result_rate[1]): continue
if (not conf.statuscode or r.status == conf.statuscode) and \
(not conf.proto or r.proto == conf.proto) and \
(not conf.resultfilter or r.__class__.__name__ == conf.resultfilter):
--
1.7.1
More information about the tor-commits
mailing list