Get IP_address for endpoint

Elbhrawy

Joined
Aug 5, 2009
Messages
17
Likes
0
Points
0
#1
I need to make a function($network , $vendor ,$mac) and return the $ipaddress for the endpoint.
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#2
Hi.

You can use a shell cmd and take the result:

# arp -n or
# apr -a

Play with the pipe - grep ( | grep ) to filter it.

Use in same time: nmap -sP --send-ip -n 192.168.1.0/24 with also | grep the vendor.

nmap -sP --send-ip -n 192.168.1.0/24 | grep Cisco for example.

Like that with this cmd you have the Mac address, and with arp you may have the IP address.

# nmap -sP --send-ip -n 192.168.1.0/24 | grep Cisco | grep '00:0B:BE:94:91:23'

MAC Address: 00:0B:BE:94:91:23 (Cisco Systems)

# arp -n | grep '00:0B:BE:94:91:23'

192.168.1.92 ether 00:0B:BE:94:91:23 C eth0
Now, with different php functions like explode for example, you can make what you want.

It's a way... :cheer:
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,566
Latest member
Fpino
Top