I would like to get a list of the wireless networks available inside a Go program running under Linux OS. It's pretty easy to get this information from a Linux command line with iwlist but I really want to have it done natively in Go. Any ideas of which package should be used? Thank you.
I was able to get the information by executing a Linux command. Here's the piece of code:
iwlistCmd := exec.Command("iwlist", iface, "scan")
iwlistCmdOut, err := iwlistCmd.Output()
if err != nil {
fmt.Println(err, "Error when getting the interface information.")
} else {
fmt.Println(string(iwlistCmdOut))
}
The output is a huge list of information and works in Linux only. As a next stel I have to find a way to extract the info I need which is the ESSID probably with strings.split package/function.