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.
orion/scripts/experiment/setupKit.go

39 lines
602 B
Go
Raw Normal View History

package main
import (
"bytes"
"fmt"
"log"
"os/exec"
)
func scanWifi(iface string) string {
command := "iwinfo"
opt := "scan"
var out bytes.Buffer
var stderr bytes.Buffer
fmt.Printf("Running %s command\n", command)
exe := exec.Command(command, iface, opt)
exe.Stdout = &out
exe.Stderr = &stderr
err := exe.Run()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + stderr.String())
log.Fatal(err)
}
return out.String()
}
func getCellInfo(iface string, ssidPrefix string) {
cells := scanWifi(iface)
fmt.Printf("%s\n", cells)
}
func main() {
getCellInfo("wlan1", "Base1")
}