socks

Details

OppySOCKSProtocol instances handle the initial SOCKS 5 handshake with client applications, passing the remote resource request to a stream, and then forwarding data back and forth between a circuit and a local application.

An OppySOCKSProtocol instance is assigned to each incoming request on the SOCKS port, and upon successful handshake negotiaton a stream is created for the client application’s request.

Once the client has made a successful request, this object goes into the forwarding state in which it:

  • forwards all subsequent data from the client to the remote resource (through a circuit)
  • sends all data written to this object’s writeData() method to the client application

Throughout this process, this object communicates with the client application via transport, as usual for Twisted Protocol objects.

class socks.socks.OppySOCKSProtocol[source]

Bases: twisted.internet.protocol.Protocol

Do SOCKS 5 handshake and forward local traffic to streams.

dataReceived(data)[source]

Either handle an incoming SOCKS handshake, make a new stream request, or forward application data on to a stream.

Called when data is received from a local application.

Parameters:data (str) – data that was received
writeData(data)[source]

Write received data to local client application.

Parameters:data (str) – data to write
closeFromStream()[source]

Lose this transports local connection.

Called by the attached stream when we want to signal to a local application that this connection has closed.

connectionLost(reason)[source]

If we have been assigned a good stream, just log that we’ve lost the connection.

Parameters:reason (reason) – reason this connection was lost
connectionMade()[source]

Log that SOCKS has made a local connection and wait for an incoming handshake request.

class socks.socks.OppySOCKSProtocolFactory[source]

Bases: twisted.internet.protocol.ServerFactory

Serve OppySOCKSProtocol instances.

protocol

alias of OppySOCKSProtocol

Previous topic

socks

Next topic

stream

This Page