-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (36 loc) · 854 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"fmt"
"os"
"os/user"
"strings"
"github.com/j3rg/WifiPlotter/wifi"
)
func main() {
currentUser, err := user.Current()
if err != nil {
fmt.Println(err)
}
if currentUser.Uid > "0" {
fmt.Println("Program must be run as root user")
os.Exit(1)
}
fmt.Println("~WifiPlotter~")
fmt.Printf("=============\n\n")
w, err := wifi.New("wlan1")
if err != nil {
fmt.Println(err)
}
w.Scan()
accesspoints := w.Results()
for _, ap := range accesspoints {
fmt.Println(ap.SSID)
fmt.Println(strings.Repeat("=", len(ap.SSID)))
fmt.Println("MAC Address: ", ap.Address)
fmt.Println("Channel: ", ap.Channel)
fmt.Println("Frequency: ", ap.Frequency, "GHz")
fmt.Println("Quality:")
fmt.Printf(" Percent: %v%%\n", ap.Quality.Percent)
fmt.Printf(" Signal: %v dBm\n\n\n", ap.Quality.Signal)
}
}