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

[tor-commits] [ooni-probe/master] Add support for obtaining the probes IP address via getinfo address



commit a8a85f89fa458c74d89eda449dcefc378b6c708b
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Thu Dec 6 22:33:37 2012 +0100

    Add support for obtaining the probes IP address via getinfo address
    * As detailed in https://trac.torproject.org/projects/tor/ticket/7447
---
 ooni/config.py |    3 +++
 ooni/runner.py |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ooni/config.py b/ooni/config.py
index b82936f..ce3fdcc 100644
--- a/ooni/config.py
+++ b/ooni/config.py
@@ -36,6 +36,9 @@ tor_control = None
 config_file = None
 sample_config_file = None
 
+# This is used to store the probes IP address obtained via Tor
+probe_ip = None
+
 def get_root_path():
     this_directory = os.path.dirname(__file__)
     root = os.path.join(this_directory, '..')
diff --git a/ooni/runner.py b/ooni/runner.py
index bc9b874..a948451 100644
--- a/ooni/runner.py
+++ b/ooni/runner.py
@@ -474,10 +474,15 @@ def startTor():
 
         socks_port = yield state.protocol.get_conf("SocksPort")
         control_port = yield state.protocol.get_conf("ControlPort")
+        client_ip = yield state.protocol.get_info("address")
 
         config.tor.socks_port = int(socks_port.values()[0])
         config.tor.control_port = int(control_port.values()[0])
 
+        config.probe_ip = client_ip.values()[0]
+
+        log.debug("Obtained our IP address from a Tor Relay %s" % config.privacy.client_ip)
+
     def setup_failed(failure):
         log.exception(failure)
         raise UnableToStartTor



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