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


Python session.wrapProtocol函数代码示例

本文整理汇总了Python中twisted.conch.ssh.session.wrapProtocol函数的典型用法代码示例。如果您正苦于以下问题:Python wrapProtocol函数的具体用法?Python wrapProtocol怎么用?Python wrapProtocol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execCommand

 def execCommand(self, processprotocol, cmd):
     """
     """
     self.protocol = insults.LoggingServerProtocol(
         protocol.HoneyPotExecProtocol, self, cmd)
     self.protocol.makeConnection(processprotocol)
     processprotocol.makeConnection(session.wrapProtocol(self.protocol))
开发者ID:ZionOps,项目名称:cowrie,代码行数:7,代码来源:session.py

示例2: openShell

    def openShell(self, trans):
        """
        Called when a shell is opened by a user logging in via SSH or similar.
        """
        # Obtain a protocol instance. This is our custom Network.SSHServerProtocol.
        # The protocol controls the way that data is sent and received down the connection.
        # In our case, it presents a TTY-based user interface to the user, while all we care
        # about is sending lines to the user and receiving lines from them.
        from Network import SSHServerProtocol
        # Get the protocol instance. The protocol is also our transport.
        #     Note that the Twisted networking model is a stack of protocols,
        #     where lower level protocols transport higher level ones.
        self.transport = proto = SSHServerProtocol(self, *self.savedSize)
        # Connect the protocol and the transport together (I don't really understand why
        # it needs to be connected both ways like this, or what the wrapper does)
        proto.makeConnection(trans)
        trans.makeConnection(session.wrapProtocol(proto))
        #self.send_message("Hi there!")
        # Obtain the Player object from the database
        player_id = self.world.db.get_player_id(self.username, self._charname)
        log.debug("Username: {0}, character: {2}, id: {1}".format(self.username, player_id, self._charname))

        self.player = self.world.get_thing(player_id)
        # Finish login (what does this call do?)
        self.complete_login()
开发者ID:TerrorBite,项目名称:textgame,代码行数:25,代码来源:User.py

示例3: request_shell

 def request_shell(self, data):
     protocol  = EchoProtocol()
     transport = SSHSessionProcessProtocol(self)
     protocol.makeConnection(transport)
     transport.makeConnection(wrapProtocol(protocol))
     self.client = transport
     return True
开发者ID:mizzy,项目名称:twisted-conch-example,代码行数:7,代码来源:ssh-server.py

示例4: openShell

    def openShell(self, transport):
        """
        Write 60 lines of data to the transport, then exit.
        """
        proto = protocol.Protocol()
        proto.makeConnection(transport)
        transport.makeConnection(wrapProtocol(proto))

        # Send enough bytes to the connection so that a rekey is triggered in
        # the client.
        def write(counter):
            i = counter()
            if i == 60:
                call.stop()
                transport.session.conn.sendRequest(
                    transport.session, 'exit-status', '\x00\x00\x00\x00')
                transport.loseConnection()
            else:
                transport.write("line #%02d\n" % (i,))

        # The timing for this loop is an educated guess (and/or the result of
        # experimentation) to exercise the case where a packet is generated
        # mid-rekey.  Since the other side of the connection is (so far) the
        # OpenSSH command line client, there's no easy way to determine when the
        # rekey has been initiated.  If there were, then generating a packet
        # immediately at that time would be a better way to test the
        # functionality being tested here.
        call = LoopingCall(write, count().next)
        call.start(0.01)
开发者ID:Architektor,项目名称:PySnip,代码行数:29,代码来源:test_conch.py

示例5: openShell

 def openShell(self, processprotocol):
     """
     """
     self.protocol = insults.LoggingServerProtocol(
         protocol.HoneyPotInteractiveProtocol, self)
     self.protocol.makeConnection(processprotocol)
     processprotocol.makeConnection(session.wrapProtocol(self.protocol))
开发者ID:ZionOps,项目名称:cowrie,代码行数:7,代码来源:session.py

示例6: openShell

    def openShell(self, protocol):

        serverProtocol = insults.ServerProtocol(SSHDemoProtocol, self)

        serverProtocol.makeConnection(protocol)

        protocol.makeConnection(session.wrapProtocol(serverProtocol))
开发者ID:celord,项目名称:pythonstuff,代码行数:7,代码来源:sshServer.py

示例7: execCommand

 def execCommand(self, proto, cmd):
     serverProtocol = protocol.LoggingServerProtocol(
         protocol.HoneyPotExecProtocol, self, self.env, cmd)
     self.protocol = serverProtocol
     serverProtocol.makeConnection(proto)
     proto.makeConnection(session.wrapProtocol(serverProtocol))
     self.protocol = serverProtocol
开发者ID:andrew-morris,项目名称:cowrie,代码行数:7,代码来源:ssh.py

示例8: openShell

 def openShell(self, proto):
     serverProtocol = protocol.LoggingServerProtocol(
         protocol.HoneyPotInteractiveProtocol, self, self.env)
     self.protocol = serverProtocol
     serverProtocol.makeConnection(proto)
     proto.makeConnection(session.wrapProtocol(serverProtocol))
     #self.protocol = serverProtocol
     self.protocol = proto
开发者ID:andrew-morris,项目名称:cowrie,代码行数:8,代码来源:ssh.py

示例9: execCommand

 def execCommand(self, proto, cmd):
     p = session_wrapper_protocol(self, False)
     p.makeConnection(proto)
     proto.makeConnection(session.wrapProtocol(p))
     p.dataReceived(cmd)
     if (not cmd.endswith("\n")):
         p.dataReceived("\n")
     p.stransport.terminate()
开发者ID:dgvncsz0f,项目名称:pingpong,代码行数:8,代码来源:ssh.py

示例10: openShell

 def openShell(self, protocol):
     shell_protocol = insults.ServerProtocol(
         ShellProtocol,
         self,
         self.executables,
     )
     shell_protocol.makeConnection(protocol)
     protocol.makeConnection(session.wrapProtocol(shell_protocol))
开发者ID:Locky1138,项目名称:StubShell,代码行数:8,代码来源:StubShell.py

示例11: request_exec

 def request_exec(self, data):
     print 'request_exec', data
     protocol = SCPProtocol()
     transport = SSHSessionProcessProtocol(self)
     protocol.makeConnection(transport)
     transport.makeConnection(wrapProtocol(protocol))
     self.client = transport
     return True
开发者ID:midasplatform,项目名称:midasftpserver,代码行数:8,代码来源:authentication.py

示例12: openShell

    def openShell(self, protocol):
        serverProtocol = insults.ServerProtocol(SSHProtocol,
                                                self,
                                                self.prompt,
                                                self.commands)

        serverProtocol.makeConnection(protocol)
        protocol.makeConnection(session.wrapProtocol(serverProtocol))
开发者ID:Nikosl,项目名称:MockSSH,代码行数:8,代码来源:MockSSH.py

示例13: openShell

 def openShell(self, transport):
     """
     Use our protocol as shell session.
     """
     protocol = EchoProtocol()
     # Connect the new protocol to the transport and the transport
     # to the new protocol so they can communicate in both directions.
     protocol.makeConnection(transport)
     transport.makeConnection(session.wrapProtocol(protocol))
开发者ID:matanmaz,项目名称:SshTelnetProxy,代码行数:9,代码来源:sshsimpleserver.py

示例14: openShell

 def openShell(self, trans):
     log.msg(
         "Your terminal name is %r.  "
         "Your terminal is %d columns wide and %d rows tall." % (
             self.terminalName, self.windowSize[0], self.windowSize[1]))
     log.msg("ExampleSession: open shell!")
     ep = SSHServerConsoleProtocol(self.terminalName)
     ep.makeConnection(trans)
     trans.makeConnection(session.wrapProtocol(ep))
开发者ID:kwanggithub,项目名称:floodlight-floodlight,代码行数:9,代码来源:auth-twisted-sshd-demo.py

示例15: openShell

    def openShell(self, protocol):
        """ Open a shell and connect it to proto. """

        peer_address = protocol.getPeer().address  # IAddress
        (host, port) = (peer_address.host, peer_address.port)
        log.msg("Open shell from %s:%d." % (host, port))
        serverProtocol = ServerProtocol(GatewayTerminalProtocol, self.avatar)
        serverProtocol.makeConnection(protocol)
        protocol.makeConnection(wrapProtocol(serverProtocol))
开发者ID:emil2k,项目名称:joltem,代码行数:9,代码来源:session.py


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