Well, you can get something very similar to that using a twisted hatch that works as follows:
from twisted.internet import reactor from twisted.cred import portal, checkers from twisted.conch import manhole, manhole_ssh def getManholeFactory(namespace): realm = manhole_ssh.TerminalRealm() def getManhole(_): return manhole.Manhole(namespace) realm.chainedProtocolFactory.protocolFactory = getManhole p = portal.Portal(realm) p.registerChecker( checkers.InMemoryUsernamePassword DatabaseDontUse(admin='foobar')) f = manhole_ssh.ConchFactory(p) return f reactor.listenTCP(2222, getManholeFactory(globals())) reactor.run()
Then you just go into the program via ssh;
$ ssh admin@localhost -p 2222 admin@localhost password:
Using foobar as a password.
When you log in, you will get a standard python hint where you can simply pop out the data. This is not quite the same as receiving a trace sent to the host.
Now it can be difficult to integrate into the GUI program, in which case you may need to choose a different reactor, for example, for gtk-based programs used by gtk2reactor, etc.
If you want the actual trace to be sent, you need to create a socket channel for stderr, stdin and stdout, which goes through the network instead of printing to your local host. It should not be too difficult to perform using twisted ones.
Johan Dahlin Feb 12 '09 at 21:07 2009-02-12 21:07
source share