[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16413: Fix soat.py to properly request exits. (torflow/branches/gsoc2008)
Author: mikeperry
Date: 2008-08-05 00:32:22 -0400 (Tue, 05 Aug 2008)
New Revision: 16413
Modified:
torflow/branches/gsoc2008/metatroller.py
torflow/branches/gsoc2008/soat.py
torflow/branches/gsoc2008/soatstats.py
Log:
Fix soat.py to properly request exits.
Modified: torflow/branches/gsoc2008/metatroller.py
===================================================================
--- torflow/branches/gsoc2008/metatroller.py 2008-08-05 03:21:14 UTC (rev 16412)
+++ torflow/branches/gsoc2008/metatroller.py 2008-08-05 04:32:22 UTC (rev 16413)
@@ -186,9 +186,11 @@
s.write("510 Integer expected\r\n")
elif command == "SETEXIT":
if arg:
- # XXX: This is broken.
- # FIXME: Hrmm.. if teh user is a dumbass this will fail silently
- def notlambda(sm): sm.exit_name=arg
+ exit_name = arg
+ plog("DEBUG", "Got Setexit: "+exit_name)
+ def notlambda(sm):
+ plog("DEBUG", "Job for setexit: "+exit_name)
+ sm.exit_name=exit_name
h.schedule_selmgr(notlambda)
s.write("250 OK\r\n")
else:
Modified: torflow/branches/gsoc2008/soat.py
===================================================================
--- torflow/branches/gsoc2008/soat.py 2008-08-05 03:21:14 UTC (rev 16412)
+++ torflow/branches/gsoc2008/soat.py 2008-08-05 04:32:22 UTC (rev 16413)
@@ -131,7 +131,7 @@
'USEALLEXITS 1',
'UNIFORM 0',
'BWCUTOFF 1',
- 'ORDEREXITS',
+ 'ORDEREXITS 1',
'GUARDNODES 0',
'RESETSTATS']
plog('INFO', 'Executing preliminary configuration commands')
@@ -198,7 +198,7 @@
Note: currently not used
'''
plog('NOTICE', 'Trying to set ' + `exit` + ' as the exit for the next circuit')
- self.__meta.writeline("SETEXIT " + `exit`)
+ self.__meta.writeline("SETEXIT $"+exit)
reply = self.__meta.readline()
if reply[:3] != '250':
@@ -216,7 +216,7 @@
def get_nodes_for_port(self, port):
''' ask control port for a list of nodes that allow exiting to a given port '''
routers = self.__control.read_routers(self.__control.get_network_status())
- restriction = ExitPolicyRestriction('255.255.255.255', port)
+ restriction = NodeRestrictionList([FlagsRestriction(["Running", "Valid"]), ExitPolicyRestriction('255.255.255.255', port)])
return [x for x in routers if restriction.r_is_ok(x)]
def check_all_exits_port_consistency(self):
@@ -983,16 +983,16 @@
# get the total number of nodes for ports
ssl_nodes = scanner.get_nodes_for_port(443)
- # http_nodes = scanner.get_nodes_for_port(80)
+ http_nodes = scanner.get_nodes_for_port(80)
#ssh_nodes = scanner.get_nodes_for_port(22)
ssl_nodes_n = len(ssl_nodes)
- # http_nodes_n = len(http_nodes)
+ http_nodes_n = len(http_nodes)
# ssh_nodes_n = len(ssh_nodes)
# lists of addresses (generated later with get_urls)
ssl_urls = []
- # http_urls = []
+ http_urls = []
# ssh_urls = []
# test terminating conditions for somewhat ok network coverage
@@ -1003,17 +1003,17 @@
# get some semi-random urls, try to test the exit node for each protocol needed, get a new node
while 1:
- #http_urls = get_urls(wordlist, protocol='http')
+ http_urls = get_urls(wordlist, protocol='http')
ssl_urls = ['https://mail.google.com', 'https://addons.mozilla.org', 'https://www.fastmail.fm'] # the search for https stuff is yet too slow
# https test
if not ssl_done:
# XXX Uncomment this to try using SETEXIT
- # current_exit = random.choice([x for x in ssl_nodes if ('$' + `x.idhex`) not in scanner.ssl_tested])
- # scanner.set_new_exit(current_exit.idhex)
+ current_exit = random.choice([x for x in ssl_nodes if ('$' + `x.idhex`) not in scanner.ssl_tested])
+ scanner.set_new_exit(current_exit.idhex)
# Uncomment this to try NEWNYM after SETEXIT
- # scanner.get_new_circuit()
+ scanner.get_new_circuit()
ssl_site = random.choice(ssl_urls)
scanner.check_openssl(ssl_site)
@@ -1022,15 +1022,14 @@
+ ' (~' + `((ssl_tested_n * 100) / ssl_nodes_n)` + '%)')
if ssl_tested_n >= ssl_nodes_n:
ssl_done = True
-
# http test
- '''
if not http_done:
# XXX Uncomment this to try using SETEXIT
- # current_exit = random.choice([x for x in http_nodes if ('$' + `x.idhex`) not in scanner.http_tested])
- # scanner.set_new_exit(current_exit.idhex)
+ current_exit = random.choice([x for x in http_nodes if ('$' + `x.idhex`) not in scanner.http_tested])
+ scanner.set_new_exit(current_exit.idhex)
+
# XXX Uncomment this to try NEWNYM after SETEXIT
- # scanner.get_new_circuit()
+ scanner.get_new_circuit()
http_site = random.choice(http_urls)
scanner.check_http(http_site)
@@ -1039,7 +1038,6 @@
+ ' (~' + `((http_tested_n * 100) / http_nodes_n)` + '%)')
if http_tested_n >= http_nodes_n:
http_done = True
- '''
# ssh test
'''
if not ssh_done:
Modified: torflow/branches/gsoc2008/soatstats.py
===================================================================
--- torflow/branches/gsoc2008/soatstats.py 2008-08-05 03:21:14 UTC (rev 16412)
+++ torflow/branches/gsoc2008/soatstats.py 2008-08-05 04:32:22 UTC (rev 16413)
@@ -1,3 +1,4 @@
+#!/usr/bin/python
import operator
import os
import pickle