The bash script bellow takes a MAC address as a variable and finds the IP address corresponding to this MAC address.
#!/bin/bash
read address
OUTPUT="$(nmap -sn -n /IP_ADDRESS_RANGE/ | grep -B 2 "$address" |
grep -e ^.*[0-9].[0-9].[0-9].[0-9] | awk '{print substr($0,22)}')"
if [ ${OUTPUT} = ""]; then
echo "not found"
else
echo "${OUTPUT}"
arpspoof -i wlan1 -t ${OUTPUT} /GATEWAY/
fi
Although it works fine and as expected I get a warning when I execute it and I want to find out how to fix it. The output I get after I enter the MAC address:
find.sh: 7: [: =: argument expected
/IP_ADDRESS/
**:**:**:**:*:* **:**:**:**:**:** 0806 42: arp reply 192.168.1.1 is-at **:**:**:**:*:*
Aucun commentaire:
Enregistrer un commentaire