diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-09-22 20:20:35 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-09-22 20:20:35 +0000 |
commit | da7f9d5a337bf2596a0fbda2a9b668b08c41cee6 (patch) | |
tree | 17533b23de2185503087940002c31c86972b6a64 /contrib/exitlist | |
parent | 4218f098207cedc17750ed025d939054afe7ca91 (diff) | |
download | tor-da7f9d5a337bf2596a0fbda2a9b668b08c41cee6.tar.gz tor-da7f9d5a337bf2596a0fbda2a9b668b08c41cee6.zip |
r8911@Kushana: nickm | 2006-09-22 12:24:52 -0400
Make exitlist only output each result line once.
svn:r8466
Diffstat (limited to 'contrib/exitlist')
-rwxr-xr-x | contrib/exitlist | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/exitlist b/contrib/exitlist index 2b7785fb75..de26dab89c 100755 --- a/contrib/exitlist +++ b/contrib/exitlist @@ -200,6 +200,13 @@ class Server: self.ip = ip self.policy = policy +def uniq_sort(lst): + d = {} + for item in lst: d[item] = 1 + lst = d.keys() + lst.sort() + return lst + def run(): servers = [] policy = [] @@ -237,12 +244,13 @@ def run(): else: printlist = accepters + ents = [] if VERBOSE: - for s in printlist: - print "%s\t%s"%(s.ip,s.name) + ents = uniq_sort([ "%s\t%s"%(s.ip,s.name) for s in printlist ]) else: - for s in printlist: - print s.ip + ents = uniq_sort([ s.ip for s in printlist ]) + for e in ents: + print e def _test(): import doctest, exitparse |