client_shell.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:PenguinDome 作者: quantopian 项目源码 文件源码
def main():
    args = parse_args()
    log.info('Requesting remote shell from {}', args.hostname)
    with PenguinDomeServerPeer(
            'server', local_port=get_setting('local_port'),
            logger=log, client_hostname=args.hostname) as remote, \
            TerminalPeer() as terminal:
        host = args.hostname
        script = '#!/bin/bash\npython client/endpoints/shell.py {}\n'.format(
            remote.pipe_id)
        patch_hosts('client/commands/shell-{}'.format(remote.pipe_id),
                    patch_content=script.encode('ascii'),
                    hosts=host)
        broker = InteractionBroker(terminal, remote, poll_interval=0.2)
        print('Waiting for client to connect (once connected, use "~." to '
              'disconnect)...')
        remote.poll()
        curses.wrapper(interact, broker)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号