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


Python telnetlib.DO属性代码示例

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


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

示例1: _accept_all

# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import DO [as 别名]
def _accept_all(sock, cmd, opt):
    if cmd == WILL:
        sock.sendall(IAC + DO + opt)
    elif cmd == WONT:
        sock.sendall(IAC + DONT + opt) 
开发者ID:internap,项目名称:netman,代码行数:7,代码来源:telnet.py

示例2: optcallback

# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import DO [as 别名]
def optcallback(socket, command, option):
    """Write by Tim Lister, thanks :)
    """
    cnum = ord(command)
    onum = ord(option)
    if cnum == telnetlib.WILL:  # and onum == ECHO:
        socket.write(telnetlib.IAC + telnetlib.DONT + onum)
    if cnum == telnetlib.DO and onum == telnetlib.TTYPE:
        socket.write(telnetlib.IAC + telnetlib.WONT + telnetlib.TTYPE)

        ### Uncomment the following if the spacecraft dataset is huge! and also the global variables
        # at the begining of the module
        # width = struct.pack('H', MAX_WINDOW_WIDTH)
        # height = struct.pack('H', MAX_WINDOW_HEIGHT)
        # socket.send(telnetlib.IAC + telnetlib.SB + telnetlib.NAWS + width + height + telnetlib.IAC + telnetlib.SE) 
开发者ID:ebachelet,项目名称:pyLIMA,代码行数:17,代码来源:microlparallax.py

示例3: telnet_callback

# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import DO [as 别名]
def telnet_callback(tn, command, option):
        if command == DO and option == TTYPE:
            tn.sendall(IAC + WILL + TTYPE)
            tn.sendall(IAC + SB + TTYPE + '\0' + 'LogParser' + IAC + SE)
        elif command in (DO, DONT):
            tn.sendall(IAC + WILL + option)
        elif command in (WILL, WONT):
            tn.sendall(IAC + DO + option) 
开发者ID:my8100,项目名称:logparser,代码行数:10,代码来源:telnet.py

示例4: process_IAC

# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import DO [as 别名]
def process_IAC(self, sock, cmd, option):
        """
            Read in and parse IAC commands as passed by telnetlib.

            SB/SE commands are stored in sbdataq, and passed in w/ a command
            of SE.  
        """
        if cmd == DO:
            if option == TM: # timing mark - send WILL into outgoing stream
                os.write(self.remote, IAC + WILL + TM)
            else:
                pass
        elif cmd == IP:
            # interrupt process
            os.write(self.local, chr(ord('C') & 0x1F))
        elif cmd == SB:
            pass
        elif cmd == SE:
            option = self.sbdataq[0]
            if option == NAWS: # negotiate window size.
                cols = ord(self.sbdataq[1])
                rows = ord(self.sbdataq[2])
                s = struct.pack('HHHH', rows, cols, 0, 0)
                fcntl.ioctl(self.local, termios.TIOCSWINSZ, s)
        elif cmd == DONT:
            pass
        else:
            pass 
开发者ID:sassoftware,项目名称:conary,代码行数:30,代码来源:epdb_server.py

示例5: process_IAC

# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import DO [as 别名]
def process_IAC(self, sock, cmd, option):
        """
            Read in and parse IAC commands as passed by telnetlib.

            SB/SE commands are stored in sbdataq, and passed in w/ a command
            of SE.
        """
        if cmd == DO:
            if option == TM:
                # timing mark - send WILL into outgoing stream
                os.write(self.remote, IAC + WILL + TM)
            else:
                pass
        elif cmd == IP:
            # interrupt process
            os.write(self.local, IPRESP)
        elif cmd == SB:
            pass
        elif cmd == SE:
            option = self.sbdataq[0]
            if option == NAWS[0]:
                # negotiate window size.
                cols = six.indexbytes(self.sbdataq, 1)
                rows = six.indexbytes(self.sbdataq, 2)
                s = struct.pack('HHHH', rows, cols, 0, 0)
                fcntl.ioctl(self.local, termios.TIOCSWINSZ, s)
        elif cmd == DONT:
            pass
        else:
            pass 
开发者ID:sassoftware,项目名称:epdb,代码行数:32,代码来源:epdb_server.py


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