[or-cvs] r20290: {torflow} Create a torrc and move some values to .cfg. (in torflow/trunk/NetworkScanners/ExitAuthority: . data)
mikeperry at seul.org
mikeperry at seul.org
Fri Aug 14 19:37:32 UTC 2009
Author: mikeperry
Date: 2009-08-14 15:37:31 -0400 (Fri, 14 Aug 2009)
New Revision: 20290
Added:
torflow/trunk/NetworkScanners/ExitAuthority/data/tor-data/
torflow/trunk/NetworkScanners/ExitAuthority/data/torrc
Modified:
torflow/trunk/NetworkScanners/ExitAuthority/libsoat.py
torflow/trunk/NetworkScanners/ExitAuthority/soat.py
Log:
Create a torrc and move some values to .cfg.
Added: torflow/trunk/NetworkScanners/ExitAuthority/data/torrc
===================================================================
--- torflow/trunk/NetworkScanners/ExitAuthority/data/torrc (rev 0)
+++ torflow/trunk/NetworkScanners/ExitAuthority/data/torrc 2009-08-14 19:37:31 UTC (rev 20290)
@@ -0,0 +1,9 @@
+## Configuration file for metatroller on alternate prot
+SocksPort 9210 # what port to advertise for application connections
+ControlPort 9211
+SafeLogging 0
+Log notice file ./data/tor.log
+DataDirectory ./data/tor-data
+PidFile ./data/tor.pid
+CookieAuthentication 1
+FetchUselessDescriptors 1
Modified: torflow/trunk/NetworkScanners/ExitAuthority/libsoat.py
===================================================================
--- torflow/trunk/NetworkScanners/ExitAuthority/libsoat.py 2009-08-14 18:32:41 UTC (rev 20289)
+++ torflow/trunk/NetworkScanners/ExitAuthority/libsoat.py 2009-08-14 19:37:31 UTC (rev 20290)
@@ -525,7 +525,7 @@
self.proto = "pop"
class DataHandler:
- def __init__(self, my_data_dir=data_dir):
+ def __init__(self, my_data_dir=soat_dir):
self.data_dir = my_data_dir
''' Class for saving and managing test result data '''
Modified: torflow/trunk/NetworkScanners/ExitAuthority/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/ExitAuthority/soat.py 2009-08-14 18:32:41 UTC (rev 20289)
+++ torflow/trunk/NetworkScanners/ExitAuthority/soat.py 2009-08-14 19:37:31 UTC (rev 20290)
@@ -52,7 +52,6 @@
from libsoat import *
from TorCtl import TorUtil, TorCtl, PathSupport, ScanSupport
-from TorCtl.TorUtil import meta_port, meta_host, control_port, control_host, tor_port, tor_host
from TorCtl.TorUtil import *
from TorCtl.PathSupport import *
from TorCtl.TorCtl import Connection, EventHandler, ConsensusTracker
@@ -125,8 +124,8 @@
return self.do_open(NoDNSHTTPConnection, req)
class ExitScanHandler(ScanSupport.ScanHandler):
- def __init__(self, selmgr):
- ScanSupport.ScanHandler.__init__(self, selmgr)
+ def __init__(self, c, selmgr):
+ ScanSupport.ScanHandler.__init__(self, c, selmgr)
self.rlock = threading.Lock()
self.new_nodes=True
@@ -191,7 +190,7 @@
'''
# get the structure
- routers = self.control.read_routers(self.control.get_network_status())
+ routers = self.c.read_routers(self.c.get_network_status())
bad_exits = Set([])
specific_bad_exits = [None]*len(ports_to_check)
for i in range(len(ports_to_check)):
@@ -230,7 +229,7 @@
# establish a control port connection
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((control_host, control_port))
+ s.connect((TorUtil.control_host, TorUtil.control_port))
c = Connection(s)
c.authenticate()
except socket.error, e:
@@ -238,7 +237,7 @@
plog('ERROR', e)
exit()
except AttributeError, e:
- plog('ERROR', 'A service other that the Tor control port is listening on ' + control_host + ':' + control_port)
+ plog('ERROR', 'A service other that the Tor control port is listening on ' + TorUtil.control_host + ':' + TorUtil.control_port)
plog('ERROR', e)
exit()
@@ -982,7 +981,8 @@
return TEST_INCONCLUSIVE
defaultsocket = socket.socket
- socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, tor_host, tor_port)
+ socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, TorUtil.tor_host,
+ TorUtil.tor_port)
socket.socket = socks.socksocket
(pcode, presp_headers, pnew_cookies, pmime_type, pcontent) = http_request(address, self.tor_cookie_jar, self.headers)
@@ -1774,7 +1774,8 @@
# get the cert via tor
defaultsocket = socket.socket
- socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, tor_host, tor_port)
+ socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, TorUtil.tor_host,
+ TorUtil.tor_port)
socket.socket = socks.socksocket
(code, cert, exc) = self.ssl_request(address)
@@ -1901,7 +1902,8 @@
port = 110
defaultsocket = socket.socket
- socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, tor_host, tor_port)
+ socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, TorUtil.tor_host,
+ TorUtil.tor_port)
socket.socket = socks.socksocket
capabilities_ok = False
@@ -2085,7 +2087,8 @@
plog('INFO', 'Conducting an smtp test with destination ' + address)
defaultsocket = socket.socket
- socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, tor_host, tor_port)
+ socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,
+ TorUtil.tor_host, TorUtil.tor_port)
socket.socket = socks.socksocket
ehlo1_reply = 0
@@ -2186,7 +2189,8 @@
port = 143
defaultsocket = socket.socket
- socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, tor_host, tor_port)
+ socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, TorUtil.tor_host,
+ TorUtil.tor_port)
socket.socket = socks.socksocket
capabilities_ok = None
@@ -2608,14 +2612,18 @@
else:
resume_run=-1
+ TorUtil.read_config(data_dir+"/torctl.cfg")
+
+ plog("DEBUG", "Read tor config. Got Socks proxy: "+str(TorUtil.tor_port))
+
# Make logs go to disk so resumes are less painful
#TorUtil.logfile = open(log_file_name, "a")
# initiate the connection to tor
try:
global scanhdlr
- # XXX: sync with tor somehow..
- (c,scanhdlr) = setup_handler(out_dir, tor_dir+"/control_auth_cookie")
+ (c,scanhdlr) = setup_handler(data_dir,
+ data_dir+"tor-data/control_auth_cookie")
except Exception, e:
traceback.print_exc()
plog("WARN", "Can't connect to Tor: "+str(e))
More information about the tor-commits
mailing list