• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python session.wrapProtocol函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: makeProtocol

 def makeProtocol(self):
     env = HoneyPotEnvironment()
     user = HoneyPotAvatar("root", env)
     
     serverProtocol = insults.ServerProtocol(
         HoneyPotInteractiveProtocol, user, env)
     serverProtocol.makeConnection(protocol)
     protocol.makeConnection(session.wrapProtocol(serverProtocol))
     #honeypot = HoneyPotInteractiveProtocol(user, env)
     return serverProtocol
开发者ID:hiviah,项目名称:kippo-telnet,代码行数:10,代码来源:telnet.py


示例17: attach_protocol_to_channel

def attach_protocol_to_channel(protocol, channel):
    # These are from
    # http://as.ynchrono.us/2011/08/twisted-conch-in-60-seconds-protocols.html
    transport = SSHSessionProcessProtocol(channel)
    protocol.makeConnection(transport)
    transport.makeConnection(wrapProtocol(protocol))
    channel.client = transport

    # And this one's from me :3
    channel.dataReceived = protocol.dataReceived
开发者ID:ekohl,项目名称:vncauthproxy,代码行数:10,代码来源:ssh.py


示例18: openShell

 def openShell(self, protocol):
     _log.debug("openShell %s", protocol.getHost().address.port)
     # protocol is an SSHSessionProcessProtocol object
     # protocol.getHost().address.port
     # protocol.factory
     # protocol.transport
     # TODO if port is global sshport create CLI
     ts_protocol = TSProtocol(self.avatar)
     ts_protocol.makeConnection(protocol)
     protocol.makeConnection(session.wrapProtocol(ts_protocol))
开发者ID:mjeanson,项目名称:console-server,代码行数:10,代码来源:ssh.py


示例19: execCommand

    def execCommand(self, protocol, cmd):
        cfg = config()
        if cfg.has_option('honeypot', 'exec_enabled'):
            if ( cfg.get('honeypot', 'exec_enabled') != "true" ):
                print 'exec disabled not executing command: "%s"' % cmd
                raise os.OSError

        print 'Executing command: "%s"' % cmd
        serverProtocol = LoggingServerProtocol(HoneyPotProtocol, self, self.env, cmd)
        serverProtocol.makeConnection(protocol)
        protocol.makeConnection(session.wrapProtocol(serverProtocol))
开发者ID:DTherHtun,项目名称:kippo-g0tmi1k,代码行数:11,代码来源:honeypot.py


示例20: connectionMade

    def connectionMade(self):
        processprotocol = TelnetSessionProcessProtocol(self)

        # If we are dealing with a proper Telnet client: enable server echo
        if self.transport.options:
            self.transport.willChain(SGA)
            self.transport.willChain(ECHO)

        self.protocol = insults.LoggingTelnetServerProtocol(
                cproto.HoneyPotInteractiveTelnetProtocol, self)
        self.protocol.makeConnection(processprotocol)
        processprotocol.makeConnection(session.wrapProtocol(self.protocol))
开发者ID:dmitriy-myz,项目名称:cowrie,代码行数:12,代码来源:session.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python checkers.InMemoryUsernamePasswordDatabaseDontUse类代码示例发布时间:2022-05-27
下一篇:
Python keys.Key类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap