简体   繁体   English

网络上的python交互式shell

[英]python interactive shell over network

I want to have a full python interactive shell over network (something like the default interpreter that come with a python install). 我想在网络上拥有完整的python交互式外壳(类似于python安装随附的默认解释器)。 Is there an easy way to get an interactive python shell on a remote computer using a socket ? 有没有一种简单的方法可以使用套接字在远程计算机上获取交互式python shell? I can't use SSH and don't care about security. 我不能使用SSH,也不关心安全性。 Preferably, I just want to use modules that come with python by default. 最好是,我只想使用默认情况下python附带的模块。

Edit : I don't want that the interactive shell create a window on the client side. 编辑:我不希望交互式外壳程序在客户端上创建一个窗口。 It should not be visible on the computer. 它应该在计算机上不可见。

You can simply use netcat: 您可以简单地使用netcat:

python | nc -l -p 9090 &

Then connect to it using telnet 然后使用telnet连接到它

telnet $HOSTNAME 9090

Twisted includes a Python REPL server that supports telnet access (SSH too, in case you ever manage to get an SSH client installed). Twisted包括一个支持telnet访问的Python REPL服务器(如果您设法安装了SSH客户端,则也支持SSH)。

$ twistd -n  manhole --telnetPort tcp:50023
2014-04-06 11:14:01-0400 Log opened.
2014-04-06 11:14:01-0400 twistd 12.0.0 (/usr/bin/python 2.7.3) starting up.
2014-04-06 11:14:01-0400 reactor class: twisted.internet.pollreactor.PollReactor.
2014-04-06 11:14:01-0400 ServerFactory starting on 50023
2014-04-06 11:14:01-0400 Starting factory <twisted.internet.protocol.ServerFactory instance at 0x2836c20>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM