Skip to content

Instantly share code, notes, and snippets.

View cjnaz's full-sized avatar

Chris Nelson cjnaz

  • Gilbert, Arizona, USA
View GitHub Profile
@cjnaz
cjnaz / scrape_pfsense_dhcp_leases.py
Created November 7, 2021 21:32 — forked from pletch/scrape_pfsense_dhcp_leases.py
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