'interactive(prompt = pwnlib.term.text.bold_red(\'$\') + \' \')
Does simultaneous reading and writing to the tube. In principle this just
connects the tube to standard in and standard out, but in practice this
is much more usable, since we are using :mod:`pwnlib.term` to print a
floating prompt.
Thus it only works in while in :data:`pwnlib.term.term_mode`.'

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

    self.info('Switching    to    interactive    mode')
    go = threading.Event()
    def recv_thread():
        while (not go.isSet()):
            try:
                cur = self.recv(timeout=0.05)
                cur = cur.replace('\r\n', '\n')
                if cur:
                    sys.stdout.write(cur)
                    sys.stdout.flush()
            except EOFError:
                self.info('Got    EOF    while    reading    in    interactive')
                break
    t = context.Thread(target=recv_thread)
    t.daemon = True
    t.start()
    try:
        while (not go.isSet()):
            if term.term_mode:
                data = term.readline.readline(prompt=prompt, float=True)
            else:
                data = sys.stdin.read(1)
            if data:
                try:
                    self.send(data)
                except EOFError:
                    go.set()
                    self.info('Got    EOF    while    sending    in    interactive')
            else:
                go.set()
    except KeyboardInterrupt:
        self.info('Interrupted')
        go.set()
    while t.is_alive():
        t.join(timeout=0.1)
