@module.server_handler(MODNAME)
def server(server, argv):
    if len(argv) > 1:
        print USAGE
        return

    prompt = server.conn.exchange('getprompt')
    while True:
        try:
            inp = raw_input(POSH_PROMPT + prompt).strip()
        except KeyboardInterrupt:  # Ctrl-C -> new prompt
            print
            continue
        except EOFError:  # Ctrl-D -> exit shell
            print
            break

        if inp == '':
            continue
        elif inp == 'exit':
            break
        elif module.server_commands.keys() in inp.split()[0]:
            print """[!] WARNING: You've entered a posh command into the real remote shell on the
target. Continue? (y/n)""",
            if raw_input().lower()[0] != 'y':
                continue

        server.conn.send('shell {}'.format(inp))
        try:
            while True:
                rec = server.conn.recv()
                if rec == 'shelldone':
                    break
                else:
                    print rec,
        except KeyboardInterrupt:
            server.conn.send('shellterm')
            # flush lingering socket buffer ('shelldone' and any
            # excess data) and sync client/server
            while server.conn.recv() != 'shelldone':
                pass
            print
            continue
dataset/ETHPy150Open mossberg/poet/poet/modules/shell.py/server/swapped operands of `in`