Ejemplo n.º 1
0
    def handle(self, conn):
        """ handle is called by the framework to establish a new connection to the proxy server and start processing when an incoming SOCKS client connection is established. """

        logging.info('handle_socks')
        yield readHandshake(conn)
        logging.error('read handshake')
        yield sendHandshake(conn)
        logging.error('send handshake')
        dest = (yield readRequest(conn))
        #        logging.error('read request: %s' % str(dest))
        yield sendResponse(dest, conn)
        logging.error('sent response')

        (addr, port) = uncompact(dest)
        logging.error('connecting %s:%d' % (addr, port))

        logging.info(addr)
        logging.info(port)

        client = Client()
        yield client.connect(addr, port)
        logging.info('connected %s:%d' % (addr, port))

        self.pump = Pump(conn, client, self.transport)
        yield self.pump.run()
Ejemplo n.º 2
0
    def handle(self, conn):
        """ handle is called by the framework to establish a new proxy connection to the Tor server and start processing when an incoming client connection is established. """

        logging.error('connection')
        logging.error('connecting %s:%d' % (self.addr, self.port))
        client = Client()

        try:
            yield client.connect(self.addr, self.port)
        except Exception as e:
            logging.error('Error connecting to destination')
            return

        try:
            self.pump = Pump(conn, client, self.transport)
            yield self.pump.run()
        except Exception as e:
            logging.error('Exception pumping')
            logging.error(e)
Ejemplo n.º 3
0
    def handle(self, conn):
        """ handle is called by the framework to establish a new proxy connection to the Tor server and start processing when an incoming client connection is established. """

        logging.error('connection')
        logging.error('connecting %s:%d' % (self.addr, self.port))
        client = Client()

        try:
            yield client.connect(self.addr, self.port)
        except Exception as e:
            logging.error('Error connecting to destination')
            return

        try:
            self.pump = Pump(conn, client, self.transport)
            yield self.pump.run()
        except Exception as e:
            logging.error('Exception pumping')
            logging.error(e)
Ejemplo n.º 4
0
class SocksHandler:
    """
    The SocksHandler class implements the client-side handling of pluggable transports.
    """

    transport = None

    def setTransport(self, transport):
        """ setTransport sets the pluggable transport for this proxy server """

        self.transport = transport

    @_o
    def handle(self, conn):
        """ handle is called by the framework to establish a new connection to the proxy server and start processing when an incoming SOCKS client connection is established. """

        logging.info('handle_socks')
        yield readHandshake(conn)
        logging.error('read handshake')
        yield sendHandshake(conn)
        logging.error('send handshake')
        dest = (yield readRequest(conn))
        #        logging.error('read request: %s' % str(dest))
        yield sendResponse(dest, conn)
        logging.error('sent response')

        (addr, port) = uncompact(dest)
        logging.error('connecting %s:%d' % (addr, port))

        logging.info(addr)
        logging.info(port)

        client = Client()
        yield client.connect(addr, port)
        logging.info('connected %s:%d' % (addr, port))

        self.pump = Pump(conn, client, self.transport)
        yield self.pump.run()
Ejemplo n.º 5
0
class ProxyHandler:

    """
    The ProxyHandler class implements the server-side handling of pluggable transports.
    """

    transport = None

    def __init__(self, addr, port):
        self.addr = addr
        self.port = port

    def setTransport(self, transport):
        """ setTransport sets the pluggable transport for this proxy server """

        self.transport = transport

    @_o
    def handle(self, conn):
        """ handle is called by the framework to establish a new proxy connection to the Tor server and start processing when an incoming client connection is established. """

        logging.error('connection')
        logging.error('connecting %s:%d' % (self.addr, self.port))
        client = Client()

        try:
            yield client.connect(self.addr, self.port)
        except Exception as e:
            logging.error('Error connecting to destination')
            return

        try:
            self.pump = Pump(conn, client, self.transport)
            yield self.pump.run()
        except Exception as e:
            logging.error('Exception pumping')
            logging.error(e)
Ejemplo n.º 6
0
class ProxyHandler:
    """
    The ProxyHandler class implements the server-side handling of pluggable transports.
    """

    transport = None

    def __init__(self, addr, port):
        self.addr = addr
        self.port = port

    def setTransport(self, transport):
        """ setTransport sets the pluggable transport for this proxy server """

        self.transport = transport

    @_o
    def handle(self, conn):
        """ handle is called by the framework to establish a new proxy connection to the Tor server and start processing when an incoming client connection is established. """

        logging.error('connection')
        logging.error('connecting %s:%d' % (self.addr, self.port))
        client = Client()

        try:
            yield client.connect(self.addr, self.port)
        except Exception as e:
            logging.error('Error connecting to destination')
            return

        try:
            self.pump = Pump(conn, client, self.transport)
            yield self.pump.run()
        except Exception as e:
            logging.error('Exception pumping')
            logging.error(e)