From: Jolly Roger on
In article <00A9E2EB.937B8E38(a)SendSpamHere.ORG>,
VAXman- @SendSpamHere.ORG wrote:

> In article <4c018679$0$13643$c3e8da3(a)news.astraweb.com>, JF Mezei
> <jfmezei.spamnot(a)vaxination.ca> writes:
> >Jolly Roger wrote:
> >
> >> Here's a Perl script you can easily modify to do what you want. The
> >> script looks at the output of the 'ifconfig' tool
> >
> >Running this on the server will give me the server's fixed IP address,
> >not the IP address being use by a user who has logged into the server.
> >
> >For instance for VMS, with an RSH created process:
> >
> >rem_node = f$trnlnm("SYS$REM_NODE")
> >
> >will set the symbol rem_node with the remote node's IP address.
>
> JF, JF, JF...
>
> % printenv | grep SSH
> SSH_CLIENT=192.168.2.2 54941 22
> SSH_CONNECTION=192.168.2.2 54941 192.168.2.232 22
> ^-rem IP----port^ ^--local IP-port
> SSH_TTY=/dev/ttys001
> % printenv | grep REM
> REMOTEHOST=192.168.2.2

Or examine the output of netstat or any of a number of other utilities
that report the source of your current connection.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: Jolly Roger on
In article <4c01b759$0$12769$c3e8da3(a)news.astraweb.com>,
JF Mezei <jfmezei.spamnot(a)vaxination.ca> wrote:

> VAXman- @SendSpamHere.ORG wrote:
>
> > JF, JF, JF...
> >
> > % printenv | grep SSH
>
>
> Mr VAXman, Mr VAXman, Mr VAXman...
>
> if I get in via telnet, there aren't any SSH environment variables
> created. :-(
>
>
> Ian Gregory wrote:
>
> >If you want to do it for a telnet connection take a look at:
>
> ><http://unixwiz.net/tools/whoamip.html>
>
> Thanks. Looked promising until the text "won't work on BSD". However,
> OSX does have a utmpx file, it is in /var/run instead of /etc. And there
> appear to be the callable uinterface, so perhaps that utility could be
> made to run.
>
> Interestingly, if you cat the file, it lists stuff, but using nedit, it
> shows a file with tons of nulls and none of the session text :-)
>
>
> Jolly Roger wrote:
>
> >In that case, take a look at the output of /usr/bin/last.
>
> This also looks promising. Basically look at the first record produced
> with the current username listed and it should give you your current IP
> address.

The problem with using utilities like 'last' and 'netstat' is they often
concatenate the output to fit it in columns. Proceed with caution. ; )

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: VAXman- on
In article <4c01b759$0$12769$c3e8da3(a)news.astraweb.com>, JF Mezei <jfmezei.spamnot(a)vaxination.ca> writes:
>VAXman- @SendSpamHere.ORG wrote:
>
>> JF, JF, JF...
>>
>> % printenv | grep SSH
>
>
>Mr VAXman, Mr VAXman, Mr VAXman...
>
>if I get in via telnet, there aren't any SSH environment variables
>created. :-(

Why are you using telnet?
Is the REMOTEHOST environment variable not defined?

--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG

And ever since I was a boy I never felt that I belonged Like everything they
did to me Was an experiment to see How I would cope with the illusion In which
direction would I jump Would I do it all the same As the actors in the game Or
would I spit it back at them And not get caught up in their rules And live
according to my own And not be used To find the fundamental truths It was
going to take some time Thirty five summers down the line The wisdom of each
passing year Seems to serve only to confuse Seems to serve only to confuse

From: Wes Groleau on
On 05-29-2010 20:58, Jolly Roger wrote:
> Or examine the output of netstat or any of a number of other utilities
> that report the source of your current connection.

netstat -n | egrep \
"tcp.*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.22 "

tells the remote IP and port for _all_ incoming telnet connections.
How to know which is yours? Dunno.

~/.telnetrc can be used to make commands only run when connected by telnet.

--
Wes Groleau

Local Cheerleaders Make Newsweek
http://Ideas.Lang-Learn.us/russell?itemid=1460