Переглянути джерело

Adapt a patch from goodell to let the contrib/exitlist script
take arguments rather than require direct editing.


svn:r9346

Roger Dingledine 18 роки тому
батько
коміт
b955ddbee2
2 змінених файлів з 30 додано та 5 видалено
  1. 2 1
      ChangeLog
  2. 28 4
      contrib/exitlist

+ 2 - 1
ChangeLog

@@ -1,9 +1,10 @@
 Changes in version 0.1.2.7-alpha - 2007-??-??
-
  o Minor features:
     - Check for addresses with invalid characters at the exit as well as at
       the client, and warn less verbosely when they fail.  You can override
       this by setting ServerDNSAllowNonRFC953Addresses to 1.
+    - Adapt a patch from goodell to let the contrib/exitlist script
+      take arguments rather than require direct editing.
 
  o Major bugfixes:
     - Fix a crash bug in the presence of DNS hijacking  (reported by Andrew

+ 28 - 4
contrib/exitlist

@@ -10,11 +10,11 @@
 
  example usage (Tor 0.1.0.x and earlier):
 
-    python exitlist < ~/.tor/cached-directory
+    python exitlist 18.244.0.188:80 < ~/.tor/cached-directory
 
  example usage (Tor 0.1.1.10-alpha and later):
 
-    cat ~/.tor/cached-routers* | python exitlist
+    cat ~/.tor/cached-routers* | python exitlist 18.244.0.188:80
 
  If you're using Tor 0.1.1.18-rc or later, you should look at
  the "FetchUselessDescriptors" config option in the man page.
@@ -41,10 +41,11 @@ INVERSE = False
 #
 # Change this list to contain all of the target services you are interested
 # in.  It must contain one entry per line, each consisting of an IPv4 address,
-# a colon, and a port number.
+# a colon, and a port number. This default is only used if we don't learn
+# about any addresses from the command-line.
 #
 ADDRESSES_OF_INTEREST = """
-    192.168.0.1:80
+    1.2.3.4:80
 """
 
 
@@ -208,6 +209,29 @@ def uniq_sort(lst):
     return lst
 
 def run():
+    global VERBOSE
+    global INVERSE
+    global ADDRESSES_OF_INTEREST
+
+    if len(sys.argv) > 1:
+        try:
+            opts, pargs = getopt.getopt(sys.argv[1:], "vx")
+        except getopt.GetoptError, e:
+            print """
+usage: %s [-v] [-x] [host:port [host:port [...]]]
+    -v  verbose output
+    -x  invert results
+""" % sys.argv[0]
+            sys.exit(0)
+
+        for o, a in opts:
+            if o == "-v":
+                VERBOSE = True
+            if o == "-x":
+                INVERSE = True
+        if len(pargs):
+            ADDRESSES_OF_INTEREST = "\n".join(pargs)
+
     servers = []
     policy = []
     name = ip = None