intercept the ip address of a telnet session

The situation:
a Unix system (UnixWare 7.1.3) to which are connected other systems;
various p.c. on the LAN that they connect Unix to the system via TelNet.
The problem:
I need to intercept the address IP of the p.cs. connected via telnet to the Unix system.
Particularly, I have to know the address of the specific p.c., immediately after it has completed the login so that to be able to redirect some elaborations on its shared resources.
This use, obviously, has to be already operating in the shell, immediately after having made login.

I have tried to see between the various commands and file of system, but I have not succeeded in understanding as the system it associates a host to its ip address.

With the command "netstat - n - p tcp" I succeed at the most in knowing what systems are conversing by tcp-ip, but the problem is that this command not me from specific information for the p.c. from which I am performing the session telnet.

---
:smiley:
Original message (Italian):

Situazione:
un sistema Unix (UnixWare 7.1.3) a cui si collegano vari altri sistemi;
vari p.c. in rete locale che si collegano al sistema Unix via TelNet.
Problema:
ho bisogno di intercettare l'indirizzo IP dei p.c. che si collegano al sistema Unix.
In particolare, devo conoscere l'indirizzo del p.c. specifico, subito dopo che ha completato il login, in modo da poter reindirizzare alcune elaborazioni sulle sue risorse condivise.
Questo utilizzo, ovviamente, deve essere funzionante gi� nella shell, subito dopo aver fatto login.

Ho provato a vedere tra i vari comandi e file di sistema, ma non sono riuscito a capire come il sistema associa un host al suo indirizzo ip.

Con il comando "netstat -n -p tcp" riesco al massimo a sapere quali sistemi stanno dialogando in tcp-ip, ma il problema � che questo comando non mi da informazioni specifiche per il p.c. da cui sto eseguendo la sessione telnet.

Mi dispiace, parlo un poco Italiano, ma non so bene le parole tecnice. Inglese:

If you want to know what IP you just connected from, try adding this to the user's .profile --

MYPTY=`tty | sed 's/\/dev\///g'`
MYIP=`who | grep $MYPTY | awk '{ print $6 }' | sed -e 's/(\|)//g'`
echo $MYIP
export MYIP

This should print the IP you logged in from to your screen, as well as export the variable $MYIP for use by other things. You may want to test this in a shell script first, before you add it to the .profile. You may have to change paths to the commands, syntax may be different, etc.(this works just fine in my .bash_profile on Linux)

Di dov'�? Ho lavorato per un'azienda che ha uffici a Milano e Firenze. Ancora ho amici in Italia.

Hello.
Thank You for your answer.
I have tried to execute the example that You write, but it doesn't work in a UnixWare 7.1.3 system!
The "who" command only reports these informations:
username, line (dev), date and time of login
i.e.:
paololrp pts006 Sep 28 09:05
dbmaker pts007 Sep 28 09:08
The "who -a" command respond so:
NAME LINE TIME IDLE PID COMMENTS
. system boot Sep 28 08:56
. run-level 3 Sep 28 08:56 3 0 S
psradm . Sep 28 08:56 . 893 id= onl term=0 exit=0
p6update . Sep 28 08:56 . 894 id= p6u term=0 exit=0
rc2 . Sep 28 08:56 . 895 id= r2 term=0 exit=0
rc3 . Sep 28 08:56 . 2112 id= r3 term=0 exit=0
ln . Sep 28 08:56 . 2155 id= li term=0 exit=2
sac . Sep 28 08:56 . 2159 id= sc
dinit . Sep 28 08:56 . 2161 id= d2 term=0 exit=0
LOGIN console Sep 28 08:56 0:20 2160
contty . Sep 28 08:56 . 2164
inetd . Sep 28 08:56 . 2169
nbcots . Sep 28 08:56 . 2180
tcp . Sep 28 08:56 . 2183
i2otrans . Sep 28 08:56 . 2362 id=i2o1 term=0 exit=0
paololrp + pts006 Sep 28 09:05 . 2506
dbmaker + pts007 Sep 28 09:08 0:06 2558