Date: Wed, 28 Feb 2001 16:05:36 -0500
Reply-To: REXX Programming discussion list <REXXLIST@LISTSERV.UGA.EDU>
Sender: REXX Programming discussion list <REXXLIST@LISTSERV.UGA.EDU>
From: bobm <bobm@ROBTMIL.DYNDNS.ORG>
Subject: Question about SockGetPeerName()
Content-Type: text/plain; charset="us-ascii"
Using OS/2 I have a script that is supposed to notify me if I get portscanned. The problem is that it always returns
the address 126.96.36.199 instead of the address I scanned from. What am I doing wrong? Any help will be greatly
appreciated - here's the script..
/* Load REXX Socket library if not already loaded */
If RxFuncQuery("SockLoadFuncs") Then
Call RxFuncAdd "SockLoadFuncs","RXSOCK","SockLoadFuncs"
/* create a TCP socket for client connection requests */
Socket = SockSocket("AF_INET", "SOCK_STREAM", "0")
/* find out local IP address */
Host.!addr = SockGetHostId()
/* Bind socket to well known port 1996 */
Host.!family = "AF_INET"
Host.!port = 1996
Call SockBind Socket, "Host.!"
/* create a connection queue for 1 client */
Call SockListen Socket, 1
/* wait for a client to connect */
Say "Waiting for a client to connect..."
ClientSocket = SockAccept(Socket)
Say "Client has established connection."
xx = SockGetPeerName( socket, "address.!" )
'call play file=c:\mmos2\sounds\starmed.wav'
call lineout 'c:\work\log.txt', Date('e') Time() 'Scanned by' address.!addr