'interactive(prompt = pwnlib.term.text.bold_red(\'$\') + \' \')
If not in TTY-mode, this does exactly the same as
meth:`pwnlib.tubes.tube.tube.interactive`, otherwise
it does mostly the same.
An SSH connection in TTY-mode will typically supply its own prompt,
thus the prompt argument is ignored in this case.
We also have a few SSH-specific hacks that will ideally be removed
once the :mod:`pwnlib.term` is more mature.'

def interactive(self, prompt=(term.text.bold_red('$') + '    ')):

    if (self.process is not None):
        return super(ssh_channel, self).interactive(prompt)
    self.info('Switching    to    interactive    mode')
    term.term.show_cursor()
    event = threading.Event()
    def recv_thread(event):
        while (not event.is_set()):
            try:
                cur = self.recv(timeout=0.05)
                cur = cur.replace('\r\n', '\n')
                cur = cur.replace('\r', '')
                if (cur == None):
                    continue
                elif (cur == '\x07'):
                    continue
                sys.stdout.write(cur)
                sys.stdout.flush()
            except EOFError:
                self.info('Got    EOF    while    reading    in    interactive')
                event.set()
                break
    t = context.Thread(target=recv_thread, args=(event,))
    t.daemon = True
    t.start()
    while (not event.is_set()):
        if term.term_mode:
            try:
                data = term.key.getraw(0.1)
            except KeyboardInterrupt:
                data = [3]
            except IOError:
                if (not event.is_set()):
                    raise
        else:
            data = sys.stdin.read(1)
            if (not data):
                event.set()
            else:
                data = [ord(data)]
        if data:
            try:
                self.send(''.join((chr(c) for c in data)))
            except EOFError:
                event.set()
                self.info('Got    EOF    while    sending    in    interactive')
    while t.is_alive():
        t.join(timeout=0.1)
    term.term.hide_cursor()
