/usr/share/pyshared/pyptlib/client.py is in python-pyptlib 0.0.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Public client-side pyptlib API.
"""
from pyptlib.core import TransportPlugin
from pyptlib.client_config import ClientConfig
class ClientTransportPlugin(TransportPlugin):
"""
Runtime process for a client TransportPlugin.
"""
configType = ClientConfig
methodName = 'CMETHOD'
def reportMethodSuccess(self, name, protocol, addrport, args=None, optArgs=None):
"""
Write a message to stdout announcing that a transport was
successfully launched.
:param str name: Name of transport.
:param str protocol: Name of protocol to communicate using.
:param tuple addrport: (addr,port) where this transport is listening for connections.
:param str args: ARGS field for this transport.
:param str optArgs: OPT-ARGS field for this transport.
"""
methodLine = 'CMETHOD %s %s %s:%s' % (name, protocol,
addrport[0], addrport[1])
if args and len(args) > 0:
methodLine = methodLine + ' ARGS=' + args.join(',')
if optArgs and len(optArgs) > 0:
methodLine = methodLine + ' OPT-ARGS=' + args.join(',')
self.emit(methodLine)
def init(supported_transports):
"""DEPRECATED. Use ClientTransportPlugin().init() instead."""
client = ClientTransportPlugin()
client.init(supported_transports)
retval = {}
retval['state_loc'] = client.config.getStateLocation()
retval['transports'] = client.getTransports()
return retval
def reportSuccess(name, socksVersion, addrport, args=None, optArgs=None):
"""DEPRECATED. Use ClientTransportPlugin().reportMethodSuccess() instead."""
config = ClientTransportPlugin()
config.reportMethodSuccess(name, "socks%s" % socksVersion, addrport, args, optArgs)
def reportFailure(name, message):
"""DEPRECATED. Use ClientTransportPlugin().reportMethodError() instead."""
config = ClientTransportPlugin()
config.reportMethodError(name, message)
def reportEnd():
"""DEPRECATED. Use ClientTransportPlugin().reportMethodsEnd() instead."""
config = ClientTransportPlugin()
config.reportMethodsEnd()
|