Skip to content

Instantly share code, notes, and snippets.

View pletch's full-sized avatar

Tim pletch

  • Carmel, IN
View GitHub Profile
@pletch
pletch / get_pfqueue_data.sh
Last active September 9, 2020 16:43
Scrape pf QOS metrics for forwarding to InfluxDB
#!/bin/sh
#
# Shell script: get_pfqueue_data.sh
# Date: 21-Dec-2016
#
# Script to scrape queue metrics from pfctl
# and output in influxdb line protocol with interface name &
# q name as tags and q bytes & q drops as data.
#
# Copy this script to a directory on your pfsense machine and ensure
@pletch
pletch / scrape_pfsense_dhcp_leases.py
Last active April 12, 2024 03:02
Scrape PFSense DHCP Leases Status Page and Export Results to JSON
#!/usr/bin/env python3
# # This python script provides a function to query the pfsense (+v2.4) dhcp leases status page and return a list of tuples including
# ip, hostname, and mac address. To use, ensure LXML is installed via package manager or via pip.
#
# 16-Dec-2016 - Original release
# 3-Sep-2020 - Minor update to match formatting of leases page in latest pfSense version (2.4.5).
# 9-Sep-2020 - Backported improvements to handle table rows with missing data, use global variables for user/pass/server_ip,
# and return list from scrape function as implemented by fryguy04 in fork here:
# https://gist.github.com/fryguy04/7d12b789260c47c571f42e5bc733a813
@pletch
pletch / wl_snmpd.sh
Last active October 6, 2020 21:24 — forked from anonymous/wl_snmpd.sh
simple script to run a triggered snmp command get to wifi client info
#!/bin/sh
# Modified script to provide detailed wifi client info on atheros 9k based device with LEDE/OpenWRT. Script requires 'bc'
# package to output results. Output was designed to match the OID results from an Engenius EAP600 when queried via SNMP.
#
# Outputs summary of client stats for each radio in the following format "mac address, SNR, total data received,
# connection rate"
# Example output:
# iso.3.6.1.4.1.14125.2.1.1.15.9.0 = STRING: "cc:aa:bb:dd:ee:ff -56 445942Kb 105M,"
# iso.3.6.1.4.1.14125.2.1.1.16.9.0 = STRING: "aa:bb:cc:dd:ee:ff -64 18388740Kb 78M, bb:bb:cc:dd:ee:ff -63 77624Kb 44M,"
@pletch
pletch / scrape_opnsense_dhcp_leases.py
Last active September 24, 2023 13:16
Scrape OpnSense DHCP Leases Status Page and Export Results as List
#!/usr/bin/env python3
#
# This python script provides a function to query the opnSense (v21.3 - v23.1.x) dhcp leases status page and
# return a list of tuples including ip, hostname, and mac address. This script will not work with version 23.7.x+
# due to changes in the DHCP lease page.
# See comment from dheldt on modified version that works using api searchLeases page.
# To use the original script, ensure LXML is installed via package manager or via pip.
#
# 27-Mar-2021 - Original release