diff --git a/lib/api/source/fetch.php b/lib/api/source/fetch.php index 8163c7b..cba02fc 100755 --- a/lib/api/source/fetch.php +++ b/lib/api/source/fetch.php @@ -12,8 +12,8 @@ 'default' => [], 'feature' => [], 'identity' => [ - 'ap' => preg_replace('/\s+/', '', file_get_contents(TMP_DIR.'/net.ap')), - 'ip' => preg_replace('/\s+/', '', file_get_contents(TMP_DIR.'/net.ip')) + 'ap' => syscall(TMP_DIR.'/net.ap'), + 'ip' => syscall(TMP_DIR.'/net.ip') ] ]; diff --git a/lib/netid/ap b/lib/netid/ap new file mode 100755 index 0000000..7e12f65 --- /dev/null +++ b/lib/netid/ap @@ -0,0 +1,9 @@ +#!/bin/bash + +# (1) Get wireless iface # +IFACE=`ifconfig | grep -o -P "^w\w+"`; + +# (2) Get Access Point ID # +AP=`iwconfig $IFACE | grep -o -P 'ESSID:"SATS_.+"' | sed 's/ESSID:"SATS_//' | sed 's/"$//'`; + +echo $AP; diff --git a/lib/netid/ip b/lib/netid/ip new file mode 100755 index 0000000..05734a3 --- /dev/null +++ b/lib/netid/ip @@ -0,0 +1,9 @@ +#!/bin/bash + +# (1) Get wireless iface # +IFACE=`ifconfig | grep -o -P "^w\w+"`; + +# (2) Get Access Point ID # +IP=`ifconfig $IFACE | grep -o -P 'inet addr:[\d\.]+' | sed 's/inet addr://'`; + +echo $IP;