Python telnetlib.WONT Examples

The following are 4 code examples of telnetlib.WONT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module telnetlib , or try the search function .
Example #1
Source File: telnet.py    From flashre with GNU Lesser General Public License v3.0 6 votes vote down vote up
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) 
Example #2
Source File: telnet.py    From netman with Apache License 2.0 5 votes vote down vote up
def _accept_all(sock, cmd, opt):
    if cmd == WILL:
        sock.sendall(IAC + DO + opt)
    elif cmd == WONT:
        sock.sendall(IAC + DONT + opt) 
Example #3
Source File: microlparallax.py    From pyLIMA with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #4
Source File: telnet.py    From logparser with GNU General Public License v3.0 5 votes vote down vote up
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)