M
Matthew Warren
I'd suggest taking a look at Twisted, which contains a more complete
telnet implementation (not as important for being able to launch vi),
an ssh implementation (which you might want to use instead of telnet),
a VT102 implementation (which is actually what will help you
run programs
that want to fiddle around with the cursor in fancy ways), as
well as a
fair amount of work towards a simple terminal emulator (to
help you keep
track of what vi has done to your virtual terminal).
API docs for insults:
http://twistedmatrix.com/documents/current/api/twisted.conch.i
nsults.html
And for the telnet implementation:
http://twistedmatrix.com/documents/current/api/twisted.conch.t
elnet.html
Looking through those docs quickly leads me into quite a bewildering
maze.
As a kind of way to perhaps get me heading in the right direction and
understanding how I start to hang all that together to get what I want,
I would appreciate it if anyone could look at this little code snippet I
have, and illustrate how I can end up doing the same thing with twisted,
but end up with an interactive connection that can handle vi... From
there I will happily trundle off by myself.
I think I'm looking for help in getting that AhA! moment
Snippet;
C=telnetlib.Telnet(self.TCPAddress)
.
.
((connection / password handling etc..))
.
.
if AliasedSubbedCmd=='__interact':
if system=='UNIX':
retkey='^D'
else:
retkey='^Z'
print '\nTELNET entity '+self.Name+' entering interactive
mode. Use '+retkey+' to come back\n'
C.mt_interact()
....at this point I am essentially on the remote system command line,
with a very dumb terminal. How could I do this in twisted and end up
with a fairly clever terminal?
Thanks,
Matt.
This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer.
You should not copy the email, use it for any purpose or disclose its contents to any other person.
Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica.
It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email.
UK: Phoenix House, Colliers Way, Nottingham, NG8 6AT UK
Reception Tel: + 44 (0) 115 977 1177
Support Centre: 0845 607 7070
Fax: + 44 (0) 115 977 7000
http://www.digica.com
SOUTH AFRICA: Building 3, Parc du Cap, Mispel Road, Bellville, 7535, South Africa
Tel: + 27 (0) 21 957 4900
Fax: + 27 (0) 21 948 3135
http://www.digica.com