Skip to main content

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.

Metadata

Release files for ap-parse 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ap-parse 0.1.0
File Size Uploaded
ap-parse-0.1.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ap-parse 0.1.0
File Interpreter ABI Platform
ap_parse-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / ap-parse-0.1.0.tar.gz

Download URL ap-parse-0.1.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
af9397c9956d023bcaff9700d03a2649ed6c958003dbc32ee2ad550a7c72c8d2
BLAKE2b-256 checksum
How to use checksums
af0463b4de80b8f40d41c800380b8d100500ab3c5adfcf04574e14c97df6bf97
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ap_parse-0.1.0-py3-none-any.whl

Download URL ap_parse-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
803aadcce5a2b3b07681cfe20bffdf93fd97467d5c296c4cc21c1132ab4aa331
BLAKE2b-256 checksum
How to use checksums
e1088b90eb6246371ddca866226043ed8d4150852719f5a40c627418c62e80e1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page