CGI script

Z Freenetis Wiki
Verze z 10. 12. 2013, 10:20, kterou vytvořil Sivosha (diskuse | příspěvky) (Založena nová stránka: cs: CGI ru: CGI скрипт Support for CGI scripts can be enabled in the Settings section. = Getting MAC address = FreenetIS currently allows to obtain MAC ad...)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání


Support for CGI scripts can be enabled in the Settings section.

Getting MAC address

FreenetIS currently allows to obtain MAC address in addition to SNMP and using custom CGI scripts that you put directly on the router in question. The script should only return MAC address.

The path to the script is defined by permit CGI scripts settings, specifically in the Network tab item URL for the ARP table. The default is http://{GATEWAY_IP_ADDRESS}/cgi-bin/arp.cgi?ip_address={IP_ADDRESS}, where parameters {GATEWAY_IP_ADDRESS} and {IP_ADDRESS} will be replaced by IP address and gateway IP address, in which are searched for MAC address.

Getting the MAC address fromf the ISC DHCP server

  1. !/bin/bash
. /usr/local/lib/bashlib
echo "Content-type: text/plain"
echo ""
ip_address=`param ip_address`
cat /var/lib/dhcp/dhcpd.leases | grep -A6 $ip_address | grep "hardware ethernet" | cut -d " " -f 5 | sed 's/;//'