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

asset asset at impactdamage.com
Wed Jul 8 03:00:53 EDT 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 

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 
>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,
>.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 
>instances and then being able to manipulate the client terminals 
>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:


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

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

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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090708/db67f539/attachment-0001.htm 

More information about the Twisted-Python mailing list