[Twisted-Python] Conch, getting the avatarId, session number, and terminal protocol instance of all connected users.

asset asset at impactdamage.com
Wed Jul 8 01:00:53 MDT 2009


I got just what I needed with a custom TerminalRealm sending the avatarId 
and TerminalUser to a custom TerminalSession, grabbing client host, port, 
sessionno and terminal at openShell(); then put in some cleanup on 
closed().

Thanks for pointing me right where I needed to go!

------------------------------

On Sat, 4 Jul 2009 02:11:36 -0700, asset  wrote:
>Ive been at it for several days now trying to get at the username
>(avatarId), session id (SSHChannel session # I imagine), and terminal
>protocol instance (recvline.HistoricRecvLine) of my application's SSH
>terminal service's clients.  Specifically, I'm trying to expose these 
three
>things (for all connected users) to my terminal commands which are using
>the plugin system.
>
>I'm not considerably far off from this example for the setup,
>http://twistedmatrix.com/projects/conch/documentation/examples/demo_recvlin
e
>.tac, minus the telnet support.
>
>For the life of me I can't seem to determine how best to approach this.
>Ive come as far as getting a list of the terminal 
recvline.HistoricRecvLine
>instances and then being able to manipulate the client terminals 
directly,
>but I need the usernames from the avatars and session id as well.
>
>I imagine this is a pretty common and simple thing, so I'm hoping that
>somebody can point me in the right direction.  Please help if you can.

The realm's requestAvatar is passed the avatarId:

http://twistedmatrix.com/trac/browser/trunk/twisted/conch/manhole_ssh.py#L82


See how this realm (which I assume is the one you're using, since it is 
the
one used by demo_recvline) passes the avatarId to its `userFactory?, but 
the
`TerminalUser? which is the default `userFactory? ignores it.

It seems like you want to provide an alternate `userFactory? which saves 
the
avatarId passed to it.

For the session id, perhaps this information you can find on the 
connection
object.  See the API documentation:

http://twistedmatrix.com/documents/current/api/twisted.conch.ssh.connection.
SSHConnection.html

Jean-Paul

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20090708/db67f539/attachment.html>


More information about the Twisted-Python mailing list