obtain the PC client IP adress in a telnet session ?

obtain the PC client IP adress in a telnet session ?

Post by suppo » Tue, 05 Apr 2005 16:40:37



Hi all,

I would like to obtain the PC client IP adress in a telnet session.

I find a solution :
=============
TTY=`tty| cut -d/ -f3-5`
who -a|grep "$TTY "|awk '{ print $8 }'

But it's very slow and it's OK when I use it with the UNIX Prompt but
it doesn't work when I call this script with Progress.

Do you have another solution ?
Could you help me ?

Thank you for you help.

 
 
 

obtain the PC client IP adress in a telnet session ?

Post by Icarus Sparr » Tue, 05 Apr 2005 23:24:10



> Hi all,

> I would like to obtain the PC client IP adress in a telnet session.

> I find a solution :
> =============
> TTY=`tty| cut -d/ -f3-5`
> who -a|grep "$TTY "|awk '{ print $8 }'

> But it's very slow and it's OK when I use it with the UNIX Prompt but
> it doesn't work when I call this script with Progress.

> Do you have another solution ?
> Could you help me ?

It depends a lot on how your systems are set up.
You might already have the information in an environment variable, such as
'REMOTEIP'.
You might have the IP address stored as part of the login record, and
available using the command 'who am i'

Often the reaon for asking this question is because you want to set up the
X display automatically. Older versions of telnet don't pass the DISPLAy
variable, but they do pass the 'TERM' variable. If this is the case, then
a common trick is to set TERM to $DISPLAY, and in your shell startup see
if there is a : in the TERM value. If so set DISPLAY to TERM, and set TERM
to a standard value (xterm, rxvt, ...)

 
 
 

1. Obtaining a Telnet Client's IP Address

I need to determine a telnet client's IP address.

I understand that I can obtain the IP address of a client during and after
establishing a network connection.  However, the situation that I have is
as follows.  Users log-in to a UNIX server via Telnet and run an
application on the server.  The application needs to capture and log the
client's (Telnet user) IP address.  

Given this scenario, I need a function/system call to query the OS or the
terminal communication abstraction layer for the client's (Telnet user) IP
address.  Similar functionality exists in the UNIX "who" command.  For
example:

$ who
opstxn      tty0        Nov 30 14:16
imassis     pts/1       Nov 30 14:52    (sas342.usc.edu)
opsdh       pts/2       Nov 30 08:42    (ais-a)
$

I would appreciate any help that you may be able to provide.  Please

Thanks in advance.

--------------------------------------------------------------
Massis Isagholian
University of Southern California
Los Angeles

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

2. 2.8 to 2.9 - any reason

3. Obtaining a Telnet client's IP address

4. Problems with cern_httpd_3.0 and scripts

5. DIP: How to obtain local IP-adress

6. BSD man pages for libc.a

7. how to get ip adress of MX host for some email adress

8. RH5 & Diam. Stealth 2500

9. Prevent access to linux server when mac adress does not match ip adress

10. dynamic ip-adresses to fix adresses

11. Server obtaining client's IP Address. How?

12. Obtain IP address of client's machine in called Perl script

13. how to get IP adress of a client behind a proxy?