本文整理汇总了Python中telnetlib.WONT属性的典型用法代码示例。如果您正苦于以下问题:Python telnetlib.WONT属性的具体用法?Python telnetlib.WONT怎么用?Python telnetlib.WONT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类telnetlib
的用法示例。
在下文中一共展示了telnetlib.WONT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import WONT [as 别名]
def __init__(self, host):
self.tlnt = telnetlib.Telnet(host, 23)
# Announce that we will send strings character per character
self.write_raw(telnetlib.IAC + telnetlib.WONT + telnetlib.LINEMODE)
示例2: _accept_all
# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import WONT [as 别名]
def _accept_all(sock, cmd, opt):
if cmd == WILL:
sock.sendall(IAC + DO + opt)
elif cmd == WONT:
sock.sendall(IAC + DONT + opt)
示例3: optcallback
# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import WONT [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)
示例4: telnet_callback
# 需要导入模块: import telnetlib [as 别名]
# 或者: from telnetlib import WONT [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)