Dave
Dave

Reputation: 1935

Writing a telnet server in Python and embedding IPython as shell

I am trying to write a simple telned server that will expose a IPython shell to the connected client. Does someone know how to do that ?

The question is really about embedding the IPython shell into the Telnet server (I can probably use Twisted for the Telnet server part )

Thx

Upvotes: 2

Views: 952

Answers (2)

Kurt McKee
Kurt McKee

Reputation: 1410

You could perhaps use a true telnet or SSH server and just set the user's login shell to be IPython. For instance, given a user whose name is 'adam', perhaps you could change the user's /etc/passwd line to something like:

adam:x:1000:1000:Adam Frist,,,:/home/adam:/usr/bin/ipython

Typically the final segment in the line is an actual login shell like bash, but it doesn't have to be. The advantage is that you can skip coding the solution yourself, but there may be a disadvantage in that you might have to hack environment variable or the Python path for it to work.

You can read more about the /etc/passwd file at the Linux Information Project.

Upvotes: 1

Melug
Melug

Reputation: 1031

I think it is not possible provide full functionality of IPython, such as auto complete,.. Twisted has python shell that works well with telnet.

Upvotes: 0

Related Questions