wifiscan

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

wifiscan

go report card coverage godocs

A platform-independent WiFi scanning library for getting BSSID + RSSI from nearby access points. It should work on most Linux installations as well as Windows and OS X.

How does it work?

wifiscan works by calling the OS-specific Wifi scan utility and parsing the output. For Linux this is iwlist, for Windows it is netsh.exe and for OS X it is airport. Other systems are not supported at the moment (although, as long as they are Linux-based I believe you can install iwlist).

Install

go get -u github.com/schollz/wifiscan/...

Usage

You can use it in your Go code as:

wifis, err := wifiscan.Scan()
if err != nil {
    log.Fatal(err)
}
for _, w := range wifis {
    fmt.Println(w.SSID, w.RSSI)
}

You can also use the command-line tool as:

$ WIFI=wlan0 wifiscan
SSID                RSSI
f0:5c:19:a2:2a:01   -55
28:c6:8e:75:6f:cf   -58
f0:5c:19:a2:26:61   -72
90:72:40:1c:b8:96   -69
...

Note: When using with Linux you will need to add sudo to get a full scan.

Contributing

Pull requests are welcome. Feel free to...

  • Revise documentation
  • Add new features
  • Fix bugs
  • Suggest improvements

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeLimit = 10 * time.Second

Functions

This section is empty.

Types

type Wifi

type Wifi struct {
	ESSID string `json:"essid"`
	SSID  string `json:"ssid"`
	RSSI  int    `json:"rssi"`
}

Wifi is the data structure containing the basic elements

func Parse

func Parse(output, os string) (wifis []Wifi, err error)

Parse will parse wifi output and extract the access point information.

func Scan

func Scan(wifiInterface ...string) (wifilist []Wifi, err error)

Scan will scan the optional interface for wifi access points

Directories

Path Synopsis
cmd
wifiscan command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址