See https://stackoverflow.com/questions/1446806/getting-essid-via-ioctl-in-ruby for a possible approach