示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
    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)
示例#6
0
    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)
示例#7
0
 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)
示例#8
0
 def interact_tty(self, ttylog_file, data):
     ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INTERACT, time.time(), data)
示例#9
0
 def output_tty(self, ttylog_file, data):
     ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_OUTPUT, time.time(), data)
示例#10
0
    def input_tty(self, ttylog_file, data):

        ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data)
示例#11
0
 def interactTTY(self, ttylog_file, data):
     ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INTERACT, time.time(), data)
示例#12
0
 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)
示例#13
0
 def inputTTY(self, ttylog_file, data):
     ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_INPUT, time.time(), data)
示例#14
0
 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)
示例#15
0
 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)
示例#16
0
文件: honeypot.py 项目: DRiKE/kippo
 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)
示例#17
0
 def outputTTY(self, ttylog_file, data):
     ttylog.ttylog_write(ttylog_file, len(data), ttylog.TYPE_OUTPUT, time.time(), data)
示例#18
0
 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)