This repository contains lightweight, cross-platform Python utilities designed to audit computer infrastructure and map network topology.
The primary goal is to generate consistent, detailed JSON snapshots of Host Inventory (Hardware, OS, Docker) and Network Topology. These snapshots are intended to be uploaded to an AI assistant (Perplexity) to provide accurate context for infrastructure design, debugging, and optimization advice.
Purpose: Generates a detailed "identity card" for a specific machine.
- System: Hostname, OS version (including Distro details for Ubuntu/Debian/Raspbian), Kernel, Uptime.
- Hardware:
- Core: Motherboard model/vendor, CPU model/cores, RAM.
- GPU: Detailed probing for NVIDIA (Driver, VRAM), AMD, and Integrated graphics.
- Storage: Physical Disks (NVMe/SATA) and Mount points.
- Network: Physical NIC specs and negotiated Link Speed (e.g., 1Gbps, 10Gbps).
- Peripherals: Connected USB devices.
- Software:
- Packages: Full list of installed system packages (supports
apt,rpm,pacman,brew, andnix). - Services: Active system services (systemd, launchd, Windows Services).
- Packages: Full list of installed system packages (supports
- Network Config: Interface IPs, MAC addresses, Default Gateway, DNS servers.
- Docker: (If detected) Lists all Compose projects, running containers, renders
docker-composeconfigurations, and includes originaldocker-compose.ymlfiles for deep context.
Purpose: Scans the local network to build a topology map.
- Discovery: Dumps the ARP/Neighbor table to see who the host is talking to.
- Sweep: Optional Ping Sweep to find active IPs in a subnet.
- Nmap: Optional integration with
nmap(if installed) for deeper scanning.
These scripts are designed to be "drop-in" and run on Linux, macOS, and Windows.
- Python 3.9+
- (Optional) Nmap: For advanced network scanning in
net_probe.py.
Clone the repo and install the optional dependency psutil (highly recommended for accurate disk/network stats, though the scripts will run without it).
Run this on every machine you want to document (Servers, NAS, Dev Laptops).
Linux / macOS:
sudo python3 host_inventory.py(Note: sudo is recommended on Linux to see all listening ports and Docker details)
Windows (PowerShell):
python host_inventory.pyOutput:
Generates a file named output/inventory-<hostname>.json.
Run this from a machine inside the network you want to map.
Basic Neighbor Check:
python3 net_probe.pyActive Subnet Scan (Ping Sweep): Replace the CIDR with your actual subnet (e.g., 192.168.1.0/24 or 10.10.1.0/24)
# Scan home LAN
python3 net_probe.py --cidr 192.168.50.0/24 --ping-sweep
# Scan office
python3 net_probe.py --cidr 10.10.1.0/24 --nmapOutput:
Generates a file named output/netprobe.json.
Purpose: Extracts deep network configuration from a Ubiquiti UniFi Controller (UDM Pro, Cloud Key, etc.).
- Topology: Lists all UniFi devices (Switches, APs) and connected clients.
- Configuration: Dumps VLANs, Subnets, and WiFi settings.
- Security: Exports all Firewall Rules and Groups.
Usage: You need a local user on your UDM (Settings -> System -> Admins -> Add New Admin -> Local Access Only).
python3 unifi_inventory.py --url https://192.168.1.1 --user <username> --password <password>Output:
Generates a file named output/unifi-inventory.json.
- Run
host_inventory.pyon your key nodes. - Run
unifi_inventory.pyto get the ground truth of your network config. - Run
net_probe.pyto verify what is actually reachable. - Upload the resulting
.jsonfiles to your Perplexity Infrastructure Project. - Prompt:
"I have uploaded my UniFi config and host inventory. Are my firewall rules correctly isolating the IoT VLAN from my NAS?"
Do not commit the generated JSON files to this repository.
The inventory-*.json files contain sensitive information, including:
- Internal IP addresses.
- Environment variables (if they are hardcoded in your
docker-compose.ymlconfigs). - MAC addresses.
These files are meant for private analysis only.