Skip to content

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

iwlist Parser

The iwlist command shows a lot of useful wireless information from nearby access points in a reasonably concise way and it has become a royal pain to find any other libraries that show this wireless information succintly or that are anything other than skeletons of planned modules from years ago.

This simple parser avoids reinventing the wheel by simply working on top of a standard linux utility and parsing the output into sensible objects for use in python.

Usage

importiwlist_parser# Run scan on a particular interface (optional)INTERFACE="wlan1"cells=iwlist_parser.scan(INTERFACE)
# Iterate the returned list and print some of the elementsiflen(cells) >1:
print(cell[0].essid,":",cell[0].address)

The scan is performed, by default, on the interface "wlan0". The interface is specified as the first option to scan (as seen above). The interface is simply a string of the name of the interface:

interface="wlan0"interface2="wlan2"interface3="ens33"

etc.

Note that although "ens33" is probably a bad example as it is typically the default ethernet interface (and this program requires a wireless interface), it simply illustrates the point that the name of the device doesn't matter so long as it is a string and a valid wireless device name.

The cells themselves have several fields:

Field NameMeaning
nameThe cell name assigned by iwlist (e.g. Cell 01, Cell 02, etc.). This isn't particularly useful to end users
channelThe channel on which the AP is operating
addressThe hardware (MAC) address of the AP
frequencyThe frequency at which the AP is operating (Should be around 2.4 GHz or 5.0 GHz)
qualityThe quality of the signal (I actually don't know what this value means)
signal_levelThe strength of the signal measured in dBm, the higher the value the stronger the signal (e.g. -1 > -20)
encryption_key_statusWhether or not an encryption key is used
essidThe ESSID of the AP as reported by iwlist
bit_ratesA list of the supported bit rates of the AP in Mb/s
modeThe mode of the AP
group_cipherThe type of group cipher being used (I assume)
authentication_suitesAuthentication Suite information from the AP
extraUnlabeled items that I can't figure out the meaning/purpose of

About

A python parser for iwlist cells to make them easily usable in programs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages