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

[tor-commits] [ooni-probe/master] Remove old traceroute implementation



commit 4242d2a9642ecd68727898cf2b71b93d84d9a40f
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Nov 12 23:17:41 2012 +0100

    Remove old traceroute implementation
    * Add whatheaders download to Makefile
    * Add script to be run in before_i_commit
---
 before_i_commit.sh                  |    2 +-
 inputs/Makefile                     |    8 +++
 to-be-ported/very-old/traceroute.py |  108 -----------------------------------
 3 files changed, 9 insertions(+), 109 deletions(-)

diff --git a/before_i_commit.sh b/before_i_commit.sh
index 4a37686..f76672a 100755
--- a/before_i_commit.sh
+++ b/before_i_commit.sh
@@ -18,7 +18,7 @@ find . -type f -name "*.py[co]" -delete
 
 ./bin/ooniprobe -l before_i_commit.log -o dns_tamper_test.yamloo nettests/core/dnstamper.py -t test_inputs/dns_tamper_test_resolvers.txt -f test_inputs/dns_tamper_file.txt
 
-#./bin/ooniprobe -l before_i_commit.log -o captive_portal_test.yamloo nettests/core/captiveportal.py
+./bin/ooniprobe -l before_i_commit.log -o captive_portal_test.yamloo nettests/core/captiveportal.py
 
 ./bin/ooniprobe -l before_i_commit.log -o http_host.yamloo nettests/core/http_host.py -b http://ooni.nu/test -f test_inputs/http_host_file.txt
 
diff --git a/inputs/Makefile b/inputs/Makefile
index c70ce59..42ae1f6 100644
--- a/inputs/Makefile
+++ b/inputs/Makefile
@@ -1,3 +1,11 @@
 # This file will fetch a set of inputs that are of use to ooni-probe
+all: whatheaders lists
+
 lists:
 	git clone https://github.com/hellais/ooni-inputs.git ooni-inputs
+
+whatheaders:
+	wget http://s3.amazonaws.com/data.whatheaders.com/whatheaders-latest.xml.zip
+	unzip whatheaders-latest.xml.zip
+	mv whatheaders*.xml whatheaders.xml
+	rm whatheaders-latest.xml.zip
diff --git a/to-be-ported/very-old/traceroute.py b/to-be-ported/very-old/traceroute.py
deleted file mode 100644
index e8252c1..0000000
--- a/to-be-ported/very-old/traceroute.py
+++ /dev/null
@@ -1,108 +0,0 @@
-try:
-    from dns import resolver
-except:
-    print "Error: dnspython is not installed (http://www.dnspython.org/)"
-import gevent
-import os
-import plugoo
-
-try:
-    import scapy
-except:
-    print "Error: traceroute plugin requires scapy to be installed (http://www.secdev.org/projects/scapy)"
-
-from plugoo.assets import Asset
-from plugoo.tests import Test
-
-import socket
-
-__plugoo__ = "Traceroute"
-__desc__ = "Performs TTL walking tests"
-
-class TracerouteAsset(Asset):
-    def __init__(self, file=None):
-        self = Asset.__init__(self, file)
-
-
-class Traceroute(Test):
-    """A *very* quick and dirty traceroute implementation, UDP and TCP
-    """
-    def traceroute(self, dst, dst_port=3880, src_port=3000, proto="tcp", max_hops=30):
-        dest_addr = socket.gethostbyname(dst)
-        print "Doing traceroute on %s" % dst
-
-        recv = socket.getprotobyname('icmp')
-        send = socket.getprotobyname(proto)
-        ttl = 1
-        while True:
-            recv_sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, recv)
-            if proto == "tcp":
-                send_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, send)
-            else:
-                send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, send)
-            recv_sock.settimeout(10)
-            send_sock.settimeout(10)
-
-            send_sock.setsockopt(socket.SOL_IP, socket.IP_TTL, ttl)
-            recv_sock.bind(("", src_port))
-            if proto == "tcp":
-                try:
-                    send_sock.settimeout(2)
-                    send_sock.connect((dst, dst_port))
-                except socket.timeout:
-                    pass
-
-                except Exception, e:
-                    print "Error doing connect %s" % e
-            else:
-                send_sock.sendto("", (dst, dst_port))
-
-            curr_addr = None
-            try:
-                print "receiving data..."
-                _, curr_addr = recv_sock.recvfrom(512)
-                curr_addr = curr_addr[0]
-
-            except socket.error, e:
-                print "SOCKET ERROR: %s" % e
-
-            except Exception, e:
-                print "ERROR: %s" % e
-
-            finally:
-                send_sock.close()
-                recv_sock.close()
-
-            if curr_addr is not None:
-                curr_host = "%s" % curr_addr
-            else:
-                curr_host = "*"
-
-            print "%d\t%s" % (ttl, curr_host)
-
-            if curr_addr == dest_addr or ttl > max_hops:
-                break
-
-            ttl += 1
-
-
-    def experiment(self, *a, **kw):
-        # this is just a dirty hack
-        address = kw['data'][0]
-
-        self.traceroute(address)
-
-def run(ooni):
-    """Run the test"""
-    config = ooni.config
-    urls = []
-
-    traceroute_experiment = TracerouteAsset(os.path.join(config.main.assetdir, \
-                                            config.tests.traceroute))
-
-    assets = [traceroute_experiment]
-
-    traceroute = Traceroute(ooni)
-    ooni.logger.info("starting traceroute test")
-    traceroute.run(assets)
-    ooni.logger.info("finished")



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits