#!/usr/bin/python import struct import socket import telnetlib def readuntil(f, delim='# '): data = '' while not data.endswith(delim): c = f.read(1) assert len(c) > 0 data += c return data def p(v): return struct.pack('