コード例 #1
0
 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')
コード例 #2
0
ファイル: actuators.py プロジェクト: Jonty/doord
    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()
コード例 #3
0
ファイル: telnet.py プロジェクト: willxyu/pymudclient
 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
コード例 #4
0
ファイル: multiplexer.py プロジェクト: TheJJ/x-tier
    def __init__(self, connection):
        Telnet.__init__(self)

        self.connection = connection

        if self.connection and self.connection.connected:
            self.connection.register(self)

        else:
            self.abortConnection()
コード例 #5
0
    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()
コード例 #6
0
ファイル: twister.py プロジェクト: rayleyva/trigger
 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)
コード例 #7
0
ファイル: telnet.py プロジェクト: bubthegreat/mudpyl
 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
コード例 #8
0
    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()
コード例 #9
0
    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)
コード例 #10
0
    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)
コード例 #11
0
ファイル: actuators.py プロジェクト: derfred/doord
 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
コード例 #12
0
 def __init__(self):
     Telnet.__init__(self)
コード例 #13
0
ファイル: lib.py プロジェクト: wrohdewald/halirc
 def __init__(self):
     Telnet.__init__(self)
コード例 #14
0
ファイル: timeoffset.py プロジェクト: hiidef/hiispider
 def __init__( self, *args, **kwargs ):
     self.deferred = Deferred()
     self.data = []
     Telnet.__init__(self, *args, **kwargs )
コード例 #15
0
ファイル: telnetProxy.py プロジェクト: AKJ/sage
	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)