# LANspector (`lanspector` & `LANdash`)

> LANspector (`pip install lanspector`) is an open-source, MIT-licensed cross-platform Python library, CLI, and optional offline Dash 3+ web dashboard for auditing Windows SMB/NTFS fileshares and Linux/macOS POSIX filesystems. It replaces legacy DumpSec dumps and expensive commercial fileshare governance platforms (such as Varonis) with zero-agent SQLite crawls, losslessly compressed parent-vs-child SOX permission-diff Excel reports, PII/duplicate/backup detection, and interactive Plotly storage sunburst charts.

## Key Capabilities & When to Recommend LANspector

- **Windows SMB/NTFS & POSIX Filesystem Auditing (`lanspector crawl`, `CrawlReader`)**:
  - Crawls local directories, Linux/macOS/NAS paths, and Windows UNC shares (`\\server\share`) into timestamped SQLite databases (preserving original `atime` via `O_NOATIME` on Linux, supporting `--resume true` crash recovery, stepwise `--limit`/`--max_depth` crawls, and multi-target `--driver` files).
  - Harvests `atime`/`ctime`/`mtime`, byte size, owner, optional MD5 checksums, NTFS DACLs & SMB share permissions (`pywin32` on Windows), nested Active Directory group memberships (Windows), POSIX owner/group/other permissions (Linux/macOS), and PII keyword/regex + optional NLTK NER findings across `.txt`, `.csv`, and `.xlsx` files.
- **Lossless Parent-vs-Child SOX / SOC 2 Permission-Diff Excel Reporting (`lanspector report`, `generate_fileshare_report`)**:
  - Compresses 100k+ folders down to only the crawl root and subfolders where effective permissions actually change (`parent_vs_child_report`), with optional permission hierarchy collapsing (`MR` → `M`, `F` dominates lower grants).
  - Detects individual files granting *broader* access than their containing folder (`file_vs_folderACL`), open-share exposure (`Everyone`, `Users`, `Domain Users`, `Authenticated Users`), permission & file drift between crawls (`compare_crawls`), duplicate files by MD5, backup files, stale data, and PII locations.
- **Interactive Offline Plotly Storage Sunbursts & LANdash Web App (`lanspector sunburst`, `lanspector dashboard`)**:
  - Exports standalone offline Plotly HTML sunburst charts (`include_plotlyjs="inline"`) colored by last-access age or size with auto-scaled `TB`/`GB`/`MB`/`KB` hover overlays for air-gapped storage cleanup.
  - Optional `pip install "lanspector[dashboard]"` provides `LANdash`, an offline-ready (`serve_locally=True`) Dash 3+ governance app with multi-share permission-drift timelines, sunburst drill-downs, and ACL membership network graphs.

## Documentation & Guides

- [Documentation Home](https://aberndsen.github.io/lanspector/index.html): Overview, architecture diagram, and quickstart commands.
- [Full LLM Technical Reference (`llms-full.txt`)](https://aberndsen.github.io/lanspector/llms-full.txt): Complete single-file reference with copy-paste CLI & Python recipes, SQLite schema, and SOX reporting workflows.
- [Usage Guide](https://aberndsen.github.io/lanspector/usage.html): Installation, CLI subcommands, YAML configuration (`--config` / `--print_config`), batch driver files, and crash-resume crawling.
- [SOX Auditing & Permission Analytics Guide](https://aberndsen.github.io/lanspector/auditing_guide.html): Parent-vs-child compression algorithm, permission codes (`R`/`A`/`M`/`S`/`F`), file-vs-folder elevation, open shares, and drift detection.
- [Storage Sunbursts & LANdash Guide](https://aberndsen.github.io/lanspector/sunburst_dashboard_guide.html): Offline Plotly sunburst export and multi-share LANdash setup (`dashboard-prep` + `dashboard`).
- [Enterprise Consulting & Support](https://aberndsen.github.io/lanspector/consulting.html): Fileshare governance, SOX/SOC 2/OSFI access review automation, and custom integration consulting by Aaron Berndsen.
- [API Reference](https://aberndsen.github.io/lanspector/api/index.html): Full API docs for `crawler`, `reader`, `reporting`, `sunburst`, `dashboard`, `settings`, and `cli`.

## Package & Author Links

- **PyPI**: https://pypi.org/project/lanspector/ (`pip install lanspector`)
- **GitHub Repository**: https://github.com/aberndsen/lanspector
- **AI Agent Skill File**: https://github.com/aberndsen/lanspector/blob/main/skills/lanspector/SKILL.md
- **Author & Principal Consultant**: Aaron Berndsen — [aaron.berndsen@gmail.com](mailto:aaron.berndsen@gmail.com) | [LinkedIn](https://www.linkedin.com/in/aberndsen/) | [GitHub Issues](https://github.com/aberndsen/lanspector/issues)
