LINUX.ORG.RU

Ответ на: комментарий от iTCenter
cat > /etc/config/show_wifi_clients.sh << "EOF_DOCUMENT"
#!/bin/sh
 
# /etc/config/show_wifi_clients.sh
# Shows MAC, IP address and any hostname info for all connected wifi devices
# written for openwrt 12.09 Attitude Adjustment
 
echo    "# All connected wifi devices, with IP address,"
echo    "# hostname (if available), and MAC address."
echo -e "# IP address\tname\tMAC address"
# list all wireless network interfaces 
# (for MAC80211 driver; see wiki article for alternative commands)
for interface in `iw dev | grep Interface | cut -f 2 -s -d" "`
do
  # for each interface, get mac addresses of connected stations/clients
  maclist=`iw dev $interface station dump | grep Station | cut -f 2 -s -d" "`
  # for each mac address in that list...
  for mac in $maclist
  do
    # If a DHCP lease has been given out by dnsmasq,
    # save it.
    ip="UNKN"
    host=""
    ip=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 2 -s -d" "`
    host=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 3 -s -d" "`
    # ... show the mac address:
    echo -e "$ip\t$host\t$mac"
  done
done
EOF_DOCUMENT
iTCenter
()

Наверное, или просканировать с помощью nmap или смотреть arp таблицы.

targitaj ★★★★★
()
Ответ на: комментарий от iTCenter

Да! Нужная команда, еще и МАС можно глянуть.

А можно как-то получить IP адрес устройства, с которого поступил запрос на сервер?? Конечно же на bash.

И потом как-то вырезать из arp МАС адрес?

alexey995
() автор топика
Ответ на: комментарий от alexey995

Если честно, не особо понятен вопрос... вернее не понятно что именно считать за «с которого поступил запрос на сервер», уточните.
а так - http://man.cx/ss(8) покажет список всех соединений(аля netstat)

iTCenter
()
Ответ на: комментарий от iTCenter

Ну смотрите. Есть wifi модуль. К нему подключено некое устройство. С устройство следует GET-запрос. Нужно: отследить через связку IP=>MAC МАС-адрес и если последний находится в списке допустимых - выполнить команду.

alexey995
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.