Stephen Gran on Wed, 23 Jul 2003 12:07:09 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] given a display, find a host


On Wed, Jul 23, 2003 at 11:19:17AM -0400, Jeff Abrahamson said:
> I have a program that knows that it's window is displayed on
> $DISPLAY. It would really like to know what host it is displayed on. I
> wonder if this is possible.
> 
> Before you suggest grabbing the part before the colon, note that this
> is all through ssh, so DISPLAY typically equals something like
> localhost:17.0.

I'm not sure if this is the solution you're looking for, but ssh
supports escape sequences, one of which is ~# - it lists all forwarded
connections.  No idea how to parse the output though.  I guess you could
also use some combination -L and -R, with rulesets like 
if ($local_port=30726){$remote_host=foo;} and so on.  I hate to advocate
hardcoding things that should be able to be figured out, but it's a
kludge that may be less headache.

Good luck,
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | The ideal voice for radio may be        |
|  steve@lobefin.net             | defined as showing no substance, no     |
|  http://www.lobefin.net/~steve | sex, no owner, and a message of         |
|  			         | importance for every housewife.   --    |
|  			         | Harry V. Wade                           |
 --------------------------------------------------------------------------

Attachment: pgpsyqD285nbD.pgp
Description: PGP signature