How to use the rpyc.core.Channel function in rpyc

To help you get started, we’ve selected a few rpyc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github XIA-Project / xia-core / experiments / planetlab / scripts / rpyc / utils / server.py View on Github external
changed if rpyc evolves'''
        # authenticate
        if self.authenticator:
            h, p = sock.getpeername()
            try:
                sock, credentials = self.authenticator(sock)
            except AuthenticationError:
                self.logger.info("%s:%s failed to authenticate, rejecting connection", h, p)
                return None
        else:
            credentials = None
        # build a connection
        h, p = sock.getpeername()
        config = dict(self.protocol_config, credentials=credentials, 
                      endpoints = (sock.getsockname(), sock.getpeername())) #connid="%s:%d"%(h, p))
        return Connection(self.service, Channel(SocketStream(sock)), config=config)
github Kkevsterrr / backdoorme / backdoors / shell / __pupy / rpyc / utils / server.py View on Github external
Note that this code is cut and paste from the rpyc internals and may have to be
        changed if rpyc evolves'''
        # authenticate
        if self.authenticator:
            h, p = sock.getpeername()
            try:
                sock, credentials = self.authenticator(sock)
            except AuthenticationError:
                self.logger.info("%s:%s failed to authenticate, rejecting connection", h, p)
                return None
        else:
            credentials = None
        # build a connection
        h, p = sock.getpeername()
        config = dict(self.protocol_config, credentials=credentials, connid="%s:%d"%(h, p))
        return Connection(self.service, Channel(SocketStream(sock)), config=config)
github tomerfiliba / rpyc / rpyc / utils / server.py View on Github external
def _serve_client(self, sock, credentials):
        addrinfo = sock.getpeername()
        if credentials:
            self.logger.info("welcome %s (%r)", addrinfo, credentials)
        else:
            self.logger.info("welcome %s", addrinfo)
        try:
            config = dict(self.protocol_config, credentials=credentials,
                          endpoints=(sock.getsockname(), addrinfo), logger=self.logger)
            conn = self.service._connect(Channel(SocketStream(sock)), config)
            self._handle_connection(conn)
        finally:
            self.logger.info("goodbye %s", addrinfo)
github cgtoolbox / HCom / lib / rpyc / utils / server.py View on Github external
def _serve_client(self, sock, credentials):
        h, p = sock.getpeername()
        self.logger.info("welcome %s:%s", h, p)
        try:
            config = dict(self.protocol_config, credentials = credentials)
            conn = Connection(self.service, Channel(SocketStream(sock)), 
                config = config, _lazy = True)
            conn._init_service()
            conn.serve_all()
        finally:
            self.logger.info("goodbye %s:%s", h, p)
github Kkevsterrr / backdoorme / backdoors / shell / __pupy / rpyc / utils / server.py View on Github external
def _serve_client(self, sock, credentials):
        addrinfo = sock.getpeername()
        h = addrinfo[0]
        p = addrinfo[1]
        if credentials:
            self.logger.info("welcome [%s]:%s (%r)", h, p, credentials)
        else:
            self.logger.info("welcome [%s]:%s", h, p)
        try:
            config = dict(self.protocol_config, credentials = credentials, 
                endpoints = (sock.getsockname(), addrinfo), logger = self.logger)
            conn = Connection(self.service, Channel(SocketStream(sock)),
                config = config, _lazy = True)
            conn._init_service()
            conn.serve_all()
        finally:
            self.logger.info("goodbye [%s]:%s", h, p)
github krintoxi / NoobSec-Toolkit / NoobSecToolkit / scripts / sshbackdoors / rpyc / utils / server.py View on Github external
Note that this code is cut and paste from the rpyc internals and may have to be
        changed if rpyc evolves'''
        # authenticate
        if self.authenticator:
            h, p = sock.getpeername()
            try:
                sock, credentials = self.authenticator(sock)
            except AuthenticationError:
                self.logger.info("%s:%s failed to authenticate, rejecting connection", h, p)
                return None
        else:
            credentials = None
        # build a connection
        h, p = sock.getpeername()
        config = dict(self.protocol_config, credentials=credentials, connid="%s:%d"%(h, p))
        return Connection(self.service, Channel(SocketStream(sock)), config=config)
github tomerfiliba / rpyc / rpyc / utils / twisted_integration.py View on Github external
def connectionMade(self):
        self.stream = TwistedSocketStream(self.transport)
        self.conn = rpyc.Connection(self.factory.service, Channel(self.stream), 
            config = self.factory.config, _lazy = True)
        self.conn._init_service()
        if self.factory.logging:
            log.msg("%s: connected %s" % (self, self.conn))
        if self.factory.on_connected is not None:
            reactor.callLater(0, self.factory.on_connected, self.conn)
    def connectionLost(self, reason=None):
github n1nj4sec / pupy / pupy / network / lib / streams / PupySocketStream.py View on Github external
from rpyc.lib.compat import select, select_error, get_exc_errno

from network.lib.buffer import Buffer

import threading

class addGetPeer(object):
    """ add some functions needed by some obfsproxy transports """
    def __init__(self, peer):
        self.peer=peer

    def getPeer(self):
        return self.peer

class PupyChannel(Channel):
    def __init__(self, *args, **kwargs):
        super(PupyChannel, self).__init__(*args, **kwargs)
        self.compress = True
        self.COMPRESSION_LEVEL = 5
        self.COMPRESSION_THRESHOLD = self.stream.MAX_IO_CHUNK
        self._send_channel_lock = threading.Lock()
        self._recv_channel_lock = threading.Lock()

    def consume(self):
        return self.stream.consume()

    def wake(self):
        return self.stream.wake()

    def recv(self):
        # print "RECV", threading.currentThread()