Excel Audit Reporting#
Automated Excel SOX/audit report generation for LANspector crawls.
Generate a multi-sheet Excel SOX/audit and storage-cleanup report.
Produces formatted Excel tables across dedicated worksheets:
Summary,No Access to Crawl,ACL membership,parent_vs_child,file_vs_folderACL,Possible PII Locations,Largest Directories,Largest Files,Duplicate Files,Access Time Distribution,Oldest Objects,Largest Users,Backup Files,Backup Paths, andObjects Owned by User. Empty sheets are omitted automatically.- Parameters:
- db
A
CrawlReader,MultiDB, single database path, or sequence of database paths.- fout
Destination
.xlsxworkbook path.- table
Crawl timestamp table name (defaults to latest crawl).
- limit
Maximum rows written per detail sheet (
Noneor0means unlimited).- owner
Optional owner filter for single-user reports.
- subdir
Optional subdirectory prefix filter.
- per_user
When
True, also write one workbook per discovered owner alongside fout.- acl_skip
Optional sequence of
(Domain, Name)ACL tuples excluded from permission diffs.- use_permission_hierarchy
Collapse subordinate permissions (
MR->M,Fdominates all).- skip_files_report
Omit the
file_vs_folderACLsheet whenTrue.- skip_old_acl_report
Omit legacy
new perms at child/dropped perms at childsheets whenTrue.- skip_user_owner_report
Omit the
Objects Owned by Usersheet whenTrue.- strip_pathprefix
Optional prefix stripped from displayed paths.
- report_pii
Include the
Possible PII Locationsworksheet whenTrue.
- Returns:
- pathlib.Path
Resolved path to the generated Excel workbook.
- Parameters:
db (CrawlReader | MultiDB | str | Path | Sequence[str | Path])
table (str | None)
limit (int | None)
owner (str | None)
subdir (str | None)
per_user (bool)
use_permission_hierarchy (bool)
skip_files_report (bool)
skip_old_acl_report (bool)
skip_user_owner_report (bool)
strip_pathprefix (str | None)
report_pii (bool)
- Return type:
Generate an Open Shares summary Excel workbook across one or more crawls.
- Parameters:
- crawls
Directory containing
*.dbfiles, a database path, sequence of paths,CrawlReader, orMultiDB.- fout
Destination Excel path (version suffix appended if file already exists).
- Returns:
- pandas.DataFrame or None
Open shares DataFrame written to fout, or
Noneif no share properties exist.
- Parameters:
- Return type:
DataFrame | None
- lanspector.reporting.scale_bytes_cols(df, columns=None)[source]#
Scale byte-valued columns into human-readable units (KB, MB, GB, TB, …).
- Parameters:
- df
Input DataFrame (not modified in place).
- columns
Specific columns to scale. Defaults to any column named
"bytes"or"size".
- Returns:
- pandas.DataFrame
Copy of df with scaled numeric columns renamed to
"<col> [<unit>]".
- Parameters:
- Return type:
- lanspector.reporting.version_adder(path, extension=None)[source]#
Return a non-colliding file path by appending
_v00,_v01, … if needed.
- lanspector.reporting.write_excel_table(worksheet, df, startrow=3, startcol=0, header_format=None, table_style='Table Style Medium 2', min_width=8, max_width=60)[source]#
Write df as a formatted Excel Table with auto-sized columns onto worksheet.
- Parameters:
- worksheet
XlsxWriter worksheet object.
- df
DataFrame to write.
- startrow
Zero-based top row index for the table header.
- startcol
Zero-based left column index.
- header_format
Optional XlsxWriter Format applied to header cells.
- table_style
Built-in Excel table style name.
- min_width
Minimum auto-fitted column width in characters.
- max_width
Maximum auto-fitted column width in characters.
- Parameters:
- Return type:
None