diff options
-rwxr-xr-x | files/common/www/service/cgi-bin/client_net.json | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/files/common/www/service/cgi-bin/client_net.json b/files/common/www/service/cgi-bin/client_net.json new file mode 100755 index 0000000..21c5767 --- /dev/null +++ b/files/common/www/service/cgi-bin/client_net.json @@ -0,0 +1,19 @@ +#!/bin/sh -e + +[ -n "$REMOTE_HOST" ] +{ + grep ^$REMOTE_HOST </proc/net/arp \ + | awk 'BEGIN { FS = " " } ; { print $4, $6 }' +} | { + read client_mac iface + if [ "$iface" == br-lan ]; then wired=true; else wired=false; fi + router_name="$(uci get 'system.@system[0].hostname')" + echo -e "Status: 200 OK\r +Content-Type: application/json\r +\r +{\"client_mac\": \"$client_mac\", + \"router_name\": \"$router_name\", + \"iface\": \"$iface\", + \"wired\": $wired +}" +} |