I have the following script
nmap_result=$(sudo nmap -sP 192.168.0.1/24)
own_ip=$(ifconfig wlp2s0b1 | grep inet | awk '{print $2}' | cut -d':' -f2)
temp_mac=$(echo "$nmap_result" | grep "MAC Address:" | awk '{print $3;}')
temp_ip=$(echo "$nmap_result" | grep "192.168." | awk '{print $5;}' | grep -v "$own_ip")
temp_vendor=$(echo "$nmap_result" | grep "MAC Address:" | awk '{print $4;}')
readarray -t mac <<<"$temp_mac"
readarray -t ip <<<"$temp_ip"
readarray -t vendor <<<"$temp_vendor"
len=${#mac[@]}
for (( i=0; i<${len}; i++ ));
do
echo ${vendor[i]}": "${ip[i]}" - "${mac[i]}
done
that when executing it gives me for example the following result
(Hon: 192.168.0.1 - 9x:Dx:1x:6x:Bx:Dx
(Mot: 192.168.0.5 - Ex:9x:2x:Dx:8x:Fx
(LG: 192.168.0.7 - Ax:9x:6x:Fx:Fx:Cx
(TCT: 192.168.0.8 - Bx:4x:1x:Ax:Cx:5x
(LG: 192.168.0.11 - Cx:9x:0x:5x:0x:Cx
There is some way to number and assign a value to each of the ip
for example
1. (Hon: 192.168.0.1 - 9x:Dx:1x:6x:Bx:Dx
2. (Mot: 192.168.0.5 - Ex:9x:2x:Dx:8x:Fx
3. (LG: 192.168.0.7 - Ax:9x:6x:Fx:Fx:Cx
4. (TCT: 192.168.0.8 - Bx:4x:1x:Ax:Cx:5x
5. (LG: 192.168.0.11 - Cx:9x:0x:5x:0x:Cx
and thus make a selection menu and when selecting a number to make a certain action
I hope to have explained to me