Parser for iw and iwinfo on OpenWrt devices
Project description
ap-parse
Parser for iw and iwinfo on OpenWrt devices. Currently supports only device list and connected stations data. Output from iw and iwinfo on other platforms might work, but it's not tested.
Table of contents
Installation
python -m pip install -U ap-parse
Usage
Log in to the device via SSH and run the the command of choice. Feed the output to ap-parse either programmatically or via the CLI.
-
List devices with iw:
iw dev
-
List stations with iw:
iw dev <device name> station dump
-
List devices with iwinfo:
iwinfo
-
List stations with iwinfo:
iwinfo <device name> assoclist
CLI
Pipe the command output to ap-parse. Example for iwinfo device list:
ssh <user@host> iwinfo | python -m apparse iwinfo device
Argument | Type | Values | Description |
---|---|---|---|
backend | str | iw , iwinfo |
Utility used to generate the output data |
type | str | device , station |
Type of the output data |
API
Save the command output to a file and pass it as a string to the appropriate parser. Example for iwinfo device list:
ssh <user@host> iwinfo > output.txt
import apparse
with open('output.txt', 'r', encoding='utf-8') as f:
raw_data = f.read()
parsed_data = apparse.parse_iwinfo_station(raw_data)
print(parsed_data)
In case you wish to add or remove fields or modify regexes, subclass one of the parser classes under
its respective module apparse.*_parser
.
License
MIT license. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ap-parse-0.1.0.tar.gz
.
File metadata
- Download URL: ap-parse-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af9397c9956d023bcaff9700d03a2649ed6c958003dbc32ee2ad550a7c72c8d2 |
|
MD5 | 2e3ea64a4522429b7d54fb8e3291a1c8 |
|
BLAKE2b-256 | af0463b4de80b8f40d41c800380b8d100500ab3c5adfcf04574e14c97df6bf97 |
File details
Details for the file ap_parse-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ap_parse-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 803aadcce5a2b3b07681cfe20bffdf93fd97467d5c296c4cc21c1132ab4aa331 |
|
MD5 | eac60422e1ac317f61f7cfaa5d75935d |
|
BLAKE2b-256 | e1088b90eb6246371ddca866226043ed8d4150852719f5a40c627418c62e80e1 |