Controllerless Networks

 View Only
last person joined: yesterday 

Instant Mode - the controllerless Wi-Fi solution that's easy to set up, is loaded with security and smarts, and won't break your budget

Python script to connect to VC and print AP and Client info

This thread has been viewed 9 times
  • 1.  Python script to connect to VC and print AP and Client info

    Posted Nov 25, 2022 09:48 PM
    Thought I'd share this.  Disclaimer: I don't consider myself a "developer" (I'm a "network guy" by day).  I'm sure there's plenty that could be done more efficiently, more elegant etc.  Having said that - this works for me.

    This is intended for Python 3.  Above and beyond some of the typically included/built in modules, you will likely need to install colorama and pysnmp.  I wrote this on a Debian machine, so the packages for this were python3-colorama and python3-pysnmp4 for me.  This may differ on your distro / environment.

    This uses good old insecure snmpv1/2c at the moment (I wrote this for my home network).  I may try to add snmpv3 support at a later date.

    Also I wrote this using my AP-515s running 8.6.x.x.  I have no idea how it will behave / fall apart on other models / versions.  Hopefully not too bad though...

    Here is the help showing options:

    usage: ap-client-list-aruba.py3 [-h] -vcs VCS -c COMMUNITY [-m MACFILE]
    
    Connects to Aruba IAP VC(s), enumerates APs, and connected client info.
    
    optional arguments:
      -h, --help    show this help message and exit
      -vcs VCS      Comma seperated list of VCs
      -c COMMUNITY  SNMP community
      -m MACFILE    Location of MAC address file (optional), defaults to /usr/local/etc/internal-macs.txt. Format is simply mac <tab> short_hostname. MAC format is xx:xx:xx:xx:xx:xx​


    Here is what the output looks like.  The below has been sanitized.  Also all the "UNKNOWN"s will go away and print pretty short names when you have your mac address file populated.  Try to keep the names on the short side.  I haven't tested the max length here in terms of formatting.

    Script output
    Grab it from here:

    https://github.com/vom513/vom-scripts/blob/master/ap-client-list-aruba.py3

    Raw / downloadable / pasteable:

    https://github.com/vom513/vom-scripts/raw/master/ap-client-list-aruba.py3

    Pull requests, ideas, corrections, contributions etc. very welcome.  Especially if you find it needs some tweaks to function on a different platform/version.