Permalink
Browse files

Kill some bugs

  • Loading branch information...
1 parent 04fbaf6 commit 2a2662db6945aad95e4192c48ac795679d8f58f9 @hellais hellais committed Apr 14, 2012
Showing with 11 additions and 12 deletions.
  1. +9 −3 run.py
  2. +1 −1 socksclient.py
  3. +1 −8 tor2web.py
View
12 run.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Tor2web calamity edition.
- ========================
+ =========================
Arturo Filasto' <art@globaleaks.org>
a re-implementation of Tor2web in Python over T̶o̶r̶n̶a̶d̶o̶ Twisted
@@ -18,6 +18,13 @@
import re
import gzip
+from twisted.application import service, internet
+from twisted.internet import reactor, endpoints
+from twisted.python import log
+from twisted.web import proxy, http, client, server, static
+from twisted.web.http import Request
+from twisted.web.resource import Resource
+
from StringIO import StringIO
from socksclient import SOCKSv4ClientProtocol, SOCKSWrapper
@@ -194,11 +201,10 @@ def process(self):
proxy = (None, 'localhost', 9050, True, None, None)
endpoint = endpoints.TCP4ClientEndpoint(reactor, dest[1], dest[2])
wrapper = SOCKSWrapper(reactor, proxy[1], proxy[2], endpoint)
-
f = clientFactory
-
d = wrapper.connect(f)
+
return server.NOT_DONE_YET
class Tor2webProxy(proxy.Proxy):
View
@@ -70,7 +70,7 @@ class SOCKSv4ClientFactory(ClientFactory):
protocol = SOCKSv4ClientProtocol
def buildProtocol(self, addr):
- r=ClientFactory.buildProtocol(self, addr)
+ r = ClientFactory.buildProtocol(self, addr)
r.postHandshakeEndpoint = self.postHandshakeEndpoint
r.postHandshakeFactory = self.postHandshakeFactory
r.handshakeDone = self.handshakeDone
View
@@ -16,7 +16,6 @@
import os
import sys
import hashlib
-import base64
import re
from mimetypes import guess_type
@@ -27,8 +26,6 @@
from utils import Storage
-http_client = httpclient.HTTPClient()
-
rexp = {
'href': re.compile(r'<[a-z]*\s*.*?\s*href\s*=\s*[\\\'"]?([a-z0-9/#:\-\.]*)[\\\'"]?\s*>', re.I),
'src': re.compile(r'<[a-z]*\s*.*?\s*src\s*=\s*[\\\'"]?([a-z0-9/#:\-\.]*)[\\\'"]?\s*>', re.I),
@@ -212,10 +209,7 @@ def process_request(self, req):
if self.debug:
print "Headers:"
pprint(self.headers)
- # XXX verify why here I return self.result, it appears to be
- # empty and it is probably an idea I had, but did not finish
- # implementing... (too much code, too little sleep...)
- return self.result
+ return self.address
def leaving_link(self, target):
"""
@@ -377,4 +371,3 @@ def commit(self):
finally:
cfgfile.close()
-

0 comments on commit 2a2662d

Please sign in to comment.