当前位置: 首页>>代码示例>>Python>>正文


Python connection.SSHConnection方法代码示例

本文整理汇总了Python中twisted.conch.ssh.connection.SSHConnection方法的典型用法代码示例。如果您正苦于以下问题:Python connection.SSHConnection方法的具体用法?Python connection.SSHConnection怎么用?Python connection.SSHConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.conch.ssh.connection的用法示例。


在下文中一共展示了connection.SSHConnection方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_cleanupConnectionImmediately

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def test_cleanupConnectionImmediately(self):
        """
        L{_NewConnectionHelper.cleanupConnection} closes the transport with
        C{abortConnection} if called with C{immediate} set to C{True}.
        """
        class Abortable:
            aborted = False
            def abortConnection(self):
                """
                Abort the connection.
                """
                self.aborted = True

        helper = _NewConnectionHelper(
            None, None, None, None, None, None, None, None, None, None)
        connection = SSHConnection()
        connection.transport = SSHClientTransport()
        connection.transport.transport = Abortable()
        helper.cleanupConnection(connection, True)
        self.assertTrue(connection.transport.transport.aborted) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:22,代码来源:test_endpoints.py

示例2: doConnect

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def doConnect(options):
#    log.deferr = handleError # HACK
    if '@' in options['host']:
        options['user'], options['host'] = options['host'].split('@',1)
    host = options['host']
    if not options['user']:
        options['user'] = getpass.getuser()
    if not options['port']:
        options['port'] = 22
    else:
        options['port'] = int(options['port'])
    host = options['host']
    port = options['port']
    conn = SSHConnection()
    conn.options = options
    vhk = default.verifyHostKey
    uao = default.SSHUserAuthClient(options['user'], options, conn)
    connect.connect(host, port, options, vhk, uao).addErrback(_ebExit) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:20,代码来源:cftp.py

示例3: doConnect

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def doConnect():
#    log.deferr = handleError # HACK
    if '@' in options['host']:
        options['user'], options['host'] = options['host'].split('@',1)
    if not options.identitys:
        options.identitys = ['~/.ssh/id_rsa', '~/.ssh/id_dsa']
    host = options['host']
    if not options['user']:
        options['user'] = getpass.getuser()
    if not options['port']:
        options['port'] = 22
    else:
        options['port'] = int(options['port'])
    host = options['host']
    port = options['port']
    vhk = default.verifyHostKey
    uao = default.SSHUserAuthClient(options['user'], options, SSHConnection())
    connect.connect(host, port, options, vhk, uao).addErrback(_ebExit) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:20,代码来源:conch.py

示例4: buildProtocol

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def buildProtocol(self, addr):
        # here comes the EVIL
        obj = self.userAuthObject.instance
        bases = []
        for base in obj.__class__.__bases__:
            if base == connection.SSHConnection:
                bases.append(SSHUnixClientProtocol)
            else:
                bases.append(base)
        newClass = types.ClassType(obj.__class__.__name__, tuple(bases), obj.__class__.__dict__)
        obj.__class__ = newClass
        SSHUnixClientProtocol.__init__(obj)
        log.msg('returning %s' % obj)
        if self.d:
            d = self.d
            self.d = None
            d.callback(None)
        return obj 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:20,代码来源:unix.py

示例5: doConnect

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def doConnect(options):
#    log.deferr = handleError # HACK
    if '@' in options['host']:
        options['user'], options['host'] = options['host'].split('@',1)
    host = options['host']
    if not options['user']:
        options['user'] = getpass.getuser() 
    if not options['port']:
        options['port'] = 22
    else:
        options['port'] = int(options['port'])
    host = options['host']
    port = options['port']
    conn = SSHConnection()
    conn.options = options
    vhk = default.verifyHostKey
    uao = default.SSHUserAuthClient(options['user'], options, conn)
    connect.connect(host, port, options, vhk, uao).addErrback(_ebExit) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:20,代码来源:cftp.py

示例6: doConnect

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def doConnect():
#    log.deferr = handleError # HACK
    if '@' in options['host']:
        options['user'], options['host'] = options['host'].split('@',1)
    if not options.identitys:
        options.identitys = ['~/.ssh/id_rsa', '~/.ssh/id_dsa']
    host = options['host']
    if not options['user']:
        options['user'] = getpass.getuser() 
    if not options['port']:
        options['port'] = 22
    else:
        options['port'] = int(options['port'])
    host = options['host']
    port = options['port']
    vhk = default.verifyHostKey
    uao = default.SSHUserAuthClient(options['user'], options, SSHConnection())
    connect.connect(host, port, options, vhk, uao).addErrback(_ebExit) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:20,代码来源:conch.py

示例7: __init__

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def __init__(self, channelFactory):
            connection.SSHConnection.__init__(self)
            self._channelFactory = channelFactory 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:5,代码来源:test_ssh.py

示例8: test_cleanupConnectionNotImmediately

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def test_cleanupConnectionNotImmediately(self):
        """
        L{_NewConnectionHelper.cleanupConnection} closes the transport cleanly
        if called with C{immediate} set to C{False}.
        """
        helper = _NewConnectionHelper(
            None, None, None, None, None, None, None, None, None, None)
        connection = SSHConnection()
        connection.transport = StringTransport()
        helper.cleanupConnection(connection, False)
        self.assertTrue(connection.transport.disconnecting) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:13,代码来源:test_endpoints.py

示例9: buildServerConnection

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def buildServerConnection(self):
        # make a server connection
        conn = connection.SSHConnection()
        # server connections have a 'self.transport.avatar'.
        class DummyTransport:
            def __init__(self):
                self.transport = self
            def sendPacket(self, kind, data):
                pass
            def logPrefix(self):
                return 'dummy transport'
        conn.transport = DummyTransport()
        conn.transport.avatar = self.avatar
        return conn 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:16,代码来源:test_filetransfer.py

示例10: serviceStarted

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def serviceStarted(self):
        global conn
        conn = self
        self.localForwards = []
        self.remoteForwards = {}
        if not isinstance(self, connection.SSHConnection):
            # make these fall through
            del self.__class__.requestRemoteForwarding
            del self.__class__.cancelRemoteForwarding
        onConnect() 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:12,代码来源:conch.py

示例11: connectionSecure

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def connectionSecure(self):
        if options['user']:
            user = options['user']
        else:
            user = getpass.getuser()
        self.requestService(SSHUserAuthClient(user, SSHConnection())) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:8,代码来源:tkconch.py

示例12: __init__

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def __init__(self, completed):
            connection.SSHConnection.__init__(self)
            self._completed = completed 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:5,代码来源:test_ssh.py

示例13: __init__

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def __init__(self, protocolFactory, protocolArgs, protocolKwArgs, width, height, *a, **kw):
            connection.SSHConnection.__init__(self, *a, **kw)

            self.protocolFactory = protocolFactory
            self.protocolArgs = protocolArgs
            self.protocolKwArgs = protocolKwArgs

            self.width = width
            self.height = height 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:11,代码来源:test_recvline.py

示例14: __init__

# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import SSHConnection [as 别名]
def __init__(self, p, exe=None, cmds=None):
            connection.SSHConnection.__init__(self)
            if p:
                self.spawn = (p, exe, cmds)
            else:
                self.spawn = None
            self.connected = 0
            self.remoteForwards = {} 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:10,代码来源:test_conch.py


注:本文中的twisted.conch.ssh.connection.SSHConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。