def __init__(self): Telnet.__init__(self) self.session_id = session_id() sessions[self.session_id] = self self.output_buffer = [] self.MAX_LENGTH = amp.MAX_VALUE_LENGTH * 8 self.idle_cmd = config.get('Main', 'idle command')
def connectionLost(self, reason): """Clean up and let the superclass handle it.""" Telnet.connectionLost(self, reason) LineOnlyReceiver.connectionLost(self, reason) #flush out the buffer if self._buffer: self.lineReceived(self._buffer) self.factory.realm.connectionLost()
def dataReceived(self, data): if self.fix_broken_godwars_line_endings: while broken_line_ending_pattern.match(data): data = re.sub(broken_line_ending_pattern, "\\1\r\n", data, 1) try: Telnet.dataReceived(self, data) except ValueError as e: print('Telnet error: %s'%e)
def connectionMade(self): """Call our superclasses. Late initialisation should also go here. """ self.factory.realm.connectionMade() Telnet.connectionMade(self) LineOnlyReceiver.connectionMade(self)
def __init__(self, perle_actuator, user, password, relay): Telnet.__init__(self) self.perle_actuator = perle_actuator self.user = user self.password = password self.relay = relay self.callid = None self.resetTimer()
def __init__(self, factory): Telnet.__init__(self) self.commandMap[GA] = self.ga_received self.negotiationMap[COMPRESS2] = self.turn_on_compression self.negotiationMap[GMCP] = self.handle_gmcp #LineOnlyReceiver doesn't have an __init__ method, weirdly. self.factory = factory self.allowing_compress = False self._colourparser = ColourCodeParser() self.fix_broken_godwars_line_endings = True
def __init__(self, connection): Telnet.__init__(self) self.connection = connection if self.connection and self.connection.connected: self.connection.register(self) else: self.abortConnection()
def dataReceived(self, data): if self.fix_broken_godwars_line_endings: while broken_line_ending_pattern.match(data): data = re.sub(broken_line_ending_pattern, "\\1\r\n", data, 1) try: Telnet.dataReceived(self, data) except ValueError as e: print("Telnet error: %s" % e) # It may be things getting stuck in 'escaped' self.state = "data"
def __init__(self, telnet_client): Telnet.__init__(self) self.reset() self.client = telnet_client if self not in self.client.receivers: self.client.addReceiver(self) self.outbound_buffer = '' self.inbound_buffer = '' if self.client.connected: self.ready()
def __init__(self, timeout=settings.TELNET_TIMEOUT): self.protocol = TelnetProtocol() self.waiting_for = [ ('Username: '******'Please Enter Login Name : ', self.state_username), # OLD Foundry ('User Name:', self.state_username), # Dell ('login: '******'Password: '******'' self.applicationDataReceived = self.login_state_machine self.timeout = timeout self.setTimeout(self.timeout) Telnet.__init__(self)
def __init__(self, factory): Telnet.__init__(self) self.commandMap[GA] = self.ga_received self.negotiationMap[COMPRESS2] = self.turn_on_compression #LineOnlyReceiver doesn't have an __init__ method, weirdly. self.factory = factory self.allowing_compress = False self._colourparser = ColourCodeParser() self.fix_broken_godwars_line_endings = True # MSDP support self.allowing_msdp = False self.msdp = MSDPParser(self) self.negotiationMap[MSDP] = self.msdp_negotiation
def __init__(self, telnet_client): Telnet.__init__(self) self.reset() self.client = telnet_client self.negotiationMap[GMCP] = self.gmcpReceived # telnet options to enable self.options_enabled = ( GMCP, EOR, ) self.options_disabled = () if self not in self.client.receivers: self.client.addReceiver(self) self.outbound_buffer = '' self.inbound_buffer = '' if self.client.connected: self.ready()
def __init__(self): Telnet.__init__(self) # ISageProxyReceiver receivers (like a Telnet Server or a WS Server) self.receivers = Receivers() self.compress = False self.decompressobj = zlib.decompressobj() self.compressobj = zlib.compressobj() self.gmcp = gmcp.GMCP(self) sage.gmcp = self.gmcp # make easily accessible self.gmcp_passthrough = True # send GMCP to client # Hold over incomplete app data until the next packet self.data_buffer = '' self.outbound_buffer = '' # Setup recieving GMCP negotation self.negotiationMap[GMCP] = self.gmcpReceived self.negotiationMap[COMPRESS2] = self.enableCompress # telnet options to enable self.options_enabled = ( GMCP, EOR, #COMPRESS2 # MCCP2 seems to break GMCP's Core.Ping in Achaea ) self.options_disabled = () # Used to identify a line that is only a color code self.color_prefix = chr(27) + '[1;' # Achaea will sometimes give us a line that is just a color code... self.color_newline = re.compile('^' + ESC + '\[[0-9;]*[m]' + NL)
def __init__(self): Telnet.__init__(self) # ISageProxyReceiver receivers (like a Telnet Server or a WS Server) self.receivers = Receivers() self.compress = False self.decompressobj = zlib.decompressobj() self.compressobj = zlib.compressobj() self.gmcp = gmcp.GMCP(self) sage.gmcp = self.gmcp # make easily accessible self.gmcp_passthrough = False # send GMCP to client # Hold over incomplete app data until the next packet self.data_buffer = '' self.outbound_buffer = '' # Setup recieving GMCP negotation self.negotiationMap[GMCP] = self.gmcpRecieved self.negotiationMap[COMPRESS2] = self.enableCompress # telnet options to enable self.options_enabled = ( GMCP, EOR, #COMPRESS2 # MCCP2 seems to break GMCP's Core.Ping in Achaea ) self.options_disabled = () # Used to identify a line that is only a color code self.color_prefix = chr(27) + '[1;' # Achaea will sometimes give us a line that is just a color code... self.color_newline = re.compile('^' + ESC + '\[[0-9;]*[m]' + NL)
def dataReceived(self, data): if self.compression_enabled: data = self.decompress.decompress(data) Telnet.dataReceived(self, data)
def __init__(self, perle_actuator, user, password, relay): Telnet.__init__(self) self.perle_actuator = perle_actuator self.user = user self.password = password self.relay = relay
def __init__(self): Telnet.__init__(self)
def __init__(self): Telnet.__init__(self) # Used to identify a line that is only a color code self.color_prefix = chr(27) + chr(91) + chr(49) + chr(59) # Dirty hack until I am confident GMCP negotiation is working... #self.options[GMCP] = self._OptionState() #self.options[GMCP].us.state = 'yes' # Register GMCP SN to process_GMCP #self.negotiationMap[GMCP] = self.process_GMCP # Negotiation Options self.allow_echo = False self.allow_mccp2 = False self.allow_mccp = False self.allow_atcp = False #self.allow_gmcp = True self.allow_eor = False """ # GMCP Options and data self.gmcp_enabled_modules = ["Char 1", "Char.Vitals 1", "Char.Skills 1", "Char.Items 1", "Room 1", "IRE.Rift 1", "Comm.Channel 1"] self.gmcp_data = "" self.ping_task = None self.ping_frequency = 5 self.gmcp_ping_awaiting = False self.gmcp_ping_start = 0 self.gmcp_ping_finish = 0 self.gmcp_avg = core.EMA(alpha = 0.6) # Negotation Statuses self.mccp2 = False self.atcp = False self.gmcp = False self.eor = False self.echo = False """ self.logging = core.config['logging_enabled'] # We have to use empty strings to support Cython self.full_char_set = '' self.omit_char_set = '' for n in range(256): self.full_char_set += chr(n) for n in self.full_char_set: if ord(n) < 32 or ord(n) > 200: self.omit_char_set += n if self.logging: if os.path.isdir('logs') == False: os.mkdir('logs') self.log = logging.getLogger(player.name) handler = logging.handlers.TimedRotatingFileHandler('logs/' + player.name + '.' + self.today(), 'midnight', 0) handler.suffix = "%Y%m%d" self.log.addHandler(handler) self.log.setLevel(logging.DEBUG)
def __init__( self, *args, **kwargs ): self.deferred = Deferred() self.data = [] Telnet.__init__(self, *args, **kwargs )
def commandReceived(self, command, argument): Telnet.commandReceived(self, command, argument) if argument == GMCP and command == WILL: for msg in self.factory.gmcp_handshakes: self.requestNegotiation(GMCP, msg)
def connectionLost(self, reason): self.call_remote(proxy_sessions.EndSession) basic.LineReceiver.connectionLost(self, reason) Telnet.connectionLost(self, reason) if self.session_id in sessions: del sessions[self.session_id]
def dataReceived(self, data): if self.fix_broken_godwars_line_endings: while broken_line_ending_pattern.match(data): data = re.sub(broken_line_ending_pattern, "\\1\r\n", data, 1) Telnet.dataReceived(self, data)
def commandReceived(self, command, argument): Telnet.commandReceived(self, command, argument) if argument==GMCP and command == WILL and self.factory.realm.gmcp_handler: for msg in self.factory.realm.gmcp_handler.handshakeMessages(): self.requestNegotiation(GMCP, msg)