Page 1 of 1
Mac Address
Posted: 20 Feb 2017 13:31
by mathieson
Hello,
Anyone know if it is possible to get the MAC address for my WiFi device (of the phone, not router)?
Re: Mac Address
Posted: 20 Feb 2017 14:25
by piskor
Hi
You can use action "Execute command" and use one of the commands:
ifconfig wlan0 | grep HWaddr | awk -F" " '{ print $5}'
ip link show wlan0 | grep eth | awk -F" " '{ print $2}'
Maybe there are better solutions

Re: Mac Address
Posted: 21 Feb 2017 15:33
by mathieson
Thanks for the info. Grep does not work for me when using Execute Command, and "ip link show wlan0" gives me a permission denied error.
Here is what I did in case anyone has the same problem:
Get the result of "ip link" (using Execute Command block) into a variable (in this case "iplink").
Then process result:
start=indexOf(iplink, "wlan");
pos1=indexOf(iplink, "ether", start)+6;
pos2=indexOf(iplink, "brd", start)-1;
mac=substring(iplink, pos1, pos2);
//do whatever you want with your mac after this to process as needed
global_mac=replace(mac, ":", "");
Regards,
Sam.