网络上的python交互式shell

时间:2014-04-06 07:40:17

标签: python shell networking interactive

我希望通过网络拥有一个完整的python交互式shell(类似于python安装附带的默认解释器)。有没有一种简单的方法可以使用套接字在远程计算机上获取交互式python shell?我不能使用SSH而不关心安全性。最好,我只想默认使用python附带的模块。

编辑:我不希望交互式shell在客户端创建一个窗口。它不应该在计算机上可见。

2 个答案:

答案 0 :(得分:2)

您可以简单地使用netcat:

python | nc -l -p 9090 &

然后使用telnet连接到它

telnet $HOSTNAME 9090

答案 1 :(得分:1)

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>