This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
2018-09-19 14:39:00 +02:00
|
|
|
package openwrt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
// WifiCell reprensents wifi network Cell
|
|
|
|
type WifiCell struct {
|
|
|
|
// The SSID
|
|
|
|
Ssid string
|
|
|
|
// The cell mac adress
|
|
|
|
MacAdress string
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewWifiCell returns a new WifiCell object
|
|
|
|
func NewWifiCell(ssid string, mac string) *WifiCell {
|
|
|
|
return &WifiCell{
|
|
|
|
Ssid: ssid,
|
|
|
|
MacAdress: mac,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetWifiCells retrieves all availabe wifi cells for a card !
|
|
|
|
func GetWifiCells(iface string) {
|
2018-09-19 15:22:51 +02:00
|
|
|
res := run("iwinfo", iface, "scan")
|
|
|
|
for _, line := range strings.Split(strings.TrimSuffix(res.Stdout, "\n"), "\n") {
|
2018-09-19 14:39:00 +02:00
|
|
|
fmt.Println(line)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|