Page 1 of 1

To obtain ip address

Posted: Thu Nov 04, 2010 8:44 am
by MarcoBoschi
Hi,

I need a function that if I pass mac address it returns to to me ip address.
Is there anything?

Thanks in advance

marco

Re: To obtain ip address

Posted: Thu Nov 04, 2010 9:43 am
by ukoenig
Hello Marco,

I think, this Tool will work for You ( Freeware )

Name2Ip2Mac

Image

http://www.softpedia.com/progDownload/N ... -4226.html

another one :

http://www.freewarezoom.com/archives/ip-sniffer

is a converter you can use on your PC for IP, MAC adresses and names.
Converts very fast:- ComputerNames into IpAddress or MacAddress- IpAddress into ComputerNames or MacAddressNote:
Some antivirus and antispyware programs flag Name2Ip2Mac as being infected/malware,
although the application is perfectly safe and does not pose a threat to your system...

Best Regards
Uwe :lol:

Re: To obtain ip address

Posted: Thu Nov 04, 2010 10:32 am
by MarcoBoschi
Uwe,
thanks!
I was thinking about a function included in my program.
it is not essential but it would be nice.

Marco

Re: To obtain ip address

Posted: Thu Nov 04, 2010 9:43 pm
by ADutheil
Is the function below OK for you?

FUNCTION ChkIp( cMac )
LOCAL nMacs := fCreate( "macs.bat" )
LOCAL cBuff := ""
LOCAL lRetu := .F.

fWrite( nMacs, "arp -a >macs.lst" )
fClose( nMacs )
ShellExecute( 0, "open", "macs.bat",,, )
IF ( nMacs := fOpen( "macs.lst" ) ) > 0
WHILE hb_fReadLine( nMacs, @cBuff ) = 0
IF upper( cMac ) $ upper( cBuff )
msgInfo( "IP FOUND" + CRLF + allTrim( subStr( cBuff, 1, at( cMac, cBuff ) - 1 ) ) )
lRetu := .T.
EXIT
ENDIF
ENDDO
fClose( nMacs )
ELSE
msgStop( "UNABLE TO OPEN FILE MACS.LST" )
ENDIF
fErase( "macs.bat" )
fErase( "macs.lst" )
IF !lRetu
msgStop( "MAC " + cMac + CRLF + "IP NOT FOUND!" )
ENDIF
RETURN ( lRetu )

The cMac param must be sent as xx-xx-xx-xx-xx-xx

Re: To obtain ip address

Posted: Fri Nov 05, 2010 4:24 pm
by MarcoBoschi
Ok Very good!
Many thanks

Re: To obtain ip address

Posted: Fri Nov 05, 2010 5:42 pm
by James Bott
André,

Good job thinking outside the box. I like it!

Regards,
James