def write(self, bytes, noLog=False): transport = self.transport.session.conn.transport for i in transport.interactors: i.sessionWrite(bytes) if transport.ttylog_open and not noLog: ttylog.ttylog_write(transport.ttylog_file, len(bytes), ttylog.TYPE_OUTPUT, time.time(), bytes) insults.ServerProtocol.write(self, bytes)
def write(self, bytes, noLog = False): transport = self.transport.session.conn.transport for i in transport.interactors: i.sessionWrite(bytes) if transport.ttylog_open and not noLog: ttylog.ttylog_write(transport.ttylog_file, len(bytes), ttylog.TYPE_OUTPUT, time.time(), bytes) insults.ServerProtocol.write(self, bytes)
def dataReceived(self, data, noLog=False): transport = self.transport.session.conn.transport if transport.ttylog_open and not noLog: ttylog.ttylog_write(transport.ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data) if transport.stdinlog_open and not noLog: f = file(transport.stdinlog_file, 'ab') f.write(data) f.close insults.ServerProtocol.dataReceived(self, data)
def dataReceived(self, data, noLog = False): transport = self.transport.session.conn.transport if transport.ttylog_open and not noLog: ttylog.ttylog_write(transport.ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data) if transport.stdinlog_open and not noLog: f = file( transport.stdinlog_file, 'ab' ) f.write(data) f.close insults.ServerProtocol.dataReceived(self, data)
def applicationDataReceived(self, bytes): # in command mode, we want to echo characters and buffer the input if not self.interacting: self.transport.write(bytes) if bytes in ('\r', '\n'): self.transport.write('\n') pieces = self.cmdbuf.split(' ', 1) self.cmdbuf = '' cmd, args = pieces[0], '' if len(pieces) > 1: args = pieces[1] try: func = getattr(self, 'cmd_' + cmd) except AttributeError: self.transport.write('** Unknown command.\r\n') return func(args) else: self.cmdbuf += bytes # in non-command mode we are passing input to the session we are # watching else: for c in bytes: if ord(c) == 27: # escape self.interacting.delInteractor(self) self.interacting = None self.transport.write( '\r\n** Interactive session closed.\r\n') return if not self.readonly: if type(bytes) == type(''): ttylog.ttylog_write(self.interacting.ttylog_file, len(bytes), ttylog.TYPE_INTERACT, time.time(), bytes) for c in bytes: recvline.HistoricRecvLine.keystrokeReceived( self.interacting, c, None)
def applicationDataReceived(self, bytes): # in command mode, we want to echo characters and buffer the input if not self.interacting: self.transport.write(bytes) if bytes in ('\r', '\n'): self.transport.write('\n') pieces = self.cmdbuf.split(' ', 1) self.cmdbuf = '' cmd, args = pieces[0], '' if len(pieces) > 1: args = pieces[1] try: func = getattr(self, 'cmd_' + cmd) except AttributeError: self.transport.write('** Unknown command.\r\n') return func(args) else: self.cmdbuf += bytes # in non-command mode we are passing input to the session we are # watching else: for c in bytes: if ord(c) == 27: # escape self.interacting.delInteractor(self) self.interacting = None self.transport.write( '\r\n** Interactive session closed.\r\n') return if not self.readonly: if type(bytes) == type(''): ttylog.ttylog_write( self.interacting.ttylog_file,len(bytes), ttylog.TYPE_INTERACT, time.time(), bytes) bytes = struct.pack('>Q',len(bytes)) + bytes self.interacting.client.sendPacket(94, bytes)
def keystrokeReceived(self, keyID, modifier): transport = self.terminal.transport.session.conn.transport if type(keyID) == type(''): ttylog.ttylog_write(transport.ttylog_file, len(keyID), ttylog.TYPE_INPUT, time.time(), keyID) recvline.HistoricRecvLine.keystrokeReceived(self, keyID, modifier)
def interact_tty(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INTERACT, time.time(), data)
def output_tty(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_OUTPUT, time.time(), data)
def input_tty(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data)
def interactTTY(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INTERACT, time.time(), data)
def write(self, bytes, noLog=False): if self.ttylog_open and not noLog: ttylog.ttylog_write(self.ttylog_file, len(bytes), ttylog.DIR_WRITE, time.time(), bytes) insults.ServerProtocol.write(self, bytes)
def inputTTY(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data)
def write(self, bytes, noLog = False): if self.ttylog_open and not noLog: ttylog.ttylog_write(self.ttylog_file, len(bytes), ttylog.DIR_WRITE, time.time(), bytes) insults.ServerProtocol.write(self, bytes)
def keystrokeReceived(self, keyID, modifier): if type(keyID) == type(''): ttylog.ttylog_write(self.terminal.ttylog_file, len(keyID), ttylog.DIR_READ, time.time(), keyID) recvline.HistoricRecvLine.keystrokeReceived(self, keyID, modifier)
def outputTTY(self, ttylog_file, data): ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_OUTPUT, time.time(), data)