Coder Social home page Coder Social logo

ap-parse's Introduction

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.

ap-parse's People

Contributors

alexitx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.