Added ap/ip (network identity) scripts to [api:fetch]

This commit is contained in:
xdrm-brackets 2017-07-21 17:14:47 +02:00
parent f7b5445ded
commit 6bad0902f2
3 changed files with 20 additions and 2 deletions

View File

@ -12,8 +12,8 @@
'default' => [], 'default' => [],
'feature' => [], 'feature' => [],
'identity' => [ 'identity' => [
'ap' => preg_replace('/\s+/', '', file_get_contents(TMP_DIR.'/net.ap')), 'ap' => syscall(TMP_DIR.'/net.ap'),
'ip' => preg_replace('/\s+/', '', file_get_contents(TMP_DIR.'/net.ip')) 'ip' => syscall(TMP_DIR.'/net.ip')
] ]
]; ];

9
lib/netid/ap Executable file
View File

@ -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;

9
lib/netid/ip Executable file
View File

@ -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;