LANdash Web Dashboard#

SQLite data store and ETL pipeline backing the optional LANdash web dashboard.

class lanspector.dashboard.data_prep.LanDashStore(db)[source]#

Bases: object

SQLite-backed analytical store serving the LANdash web dashboard.

Parameters:
db

Path to a LANdash SQLite database or an existing SQLAlchemy Engine.

Parameters:

db (str | pathlib.Path | Engine)

close()[source]#

Dispose the underlying SQLAlchemy engine.

Return type:

None

property acl_principals: DataFrame#

Return all distinct AD/POSIX principals stored in adobjects.

property crawl_dates: list[str]#

Return sorted ISO date strings present in parentVchild.

property fileshares: DataFrame#

Return all fileshares registered in fileshares.

get_acl_membership(crawl_date=None, acl_names=None)[source]#

Query ACL group membership records with resolved principal names.

Parameters:
crawl_date

Optional ISO crawl date filter.

acl_names

Optional list of ACL group names to filter.

Returns:
pandas.DataFrame

DataFrame with crawlDate, acl_domain, acl_name, member_domain, member_name, and nested_acl.

Parameters:
Return type:

DataFrame

get_crawl_data(crawl_date=None, domains=None, hosts=None, acl_domains=None, acl_names=None, permissions=None)[source]#

Query joined parent-vs-child permission timeline rows with optional filters.

Parameters:
crawl_date

Optional exact ISO crawl date.

domains

Optional list of fileshare domains.

hosts

Optional list of fileshare hostnames.

acl_domains

Optional list of ACL domains.

acl_names

Optional list of ACL principal names.

permissions

Optional list of permission codes (e.g. ["R", "M", "F"]).

Returns:
pandas.DataFrame

Filtered permission records.

Parameters:
Return type:

DataFrame

load_sunburst_data(domains=None, hosts=None, folder_filter=None, limit=500)[source]#

Query directory storage sizes and access dates for the dashboard sunburst panel.

Parameters:
domains

Optional list of fileshare domains.

hosts

Optional list of fileshare hosts.

folder_filter

Optional case-insensitive substring filter applied to subdir.

limit

Maximum rows ordered by size descending.

Returns:
pandas.DataFrame

DataFrame with path, domain, host, share, subdir, size, and max_atime.

Parameters:
Return type:

DataFrame

lanspector.dashboard.data_prep.generate_dashboard_data(databases, include_ntfs=True, include_acls=True, include_sunburst=True)[source]#

Extract normalized permission, membership, and sunburst tables from crawl databases.

Parameters:
databases

Sequence of LANspector SQLite crawl database paths.

include_ntfs

Extract melted parent-vs-child permission snapshots.

include_acls

Extract ACL group membership records when present.

include_sunburst

Extract directory storage & access-time records for sunburst charts.

Returns:
tuple[pandas.DataFrame, pandas.DataFrame, pandas.DataFrame]

Three DataFrames: (access_df, membership_df, sunburst_df).

Parameters:
Return type:

tuple[DataFrame, DataFrame, DataFrame]

lanspector.dashboard.data_prep.commit_data_to_database(store, access_df=None, membership_df=None, sunburst_df=None)[source]#

Persist extracted dashboard DataFrames into a LanDashStore SQLite database.

Parameters:
store

Open LanDashStore or path to a LANdash SQLite database.

access_df

Parent-vs-child permission timeline DataFrame.

membership_df

ACL membership DataFrame.

sunburst_df

Directory size and last-access DataFrame.

Parameters:
Return type:

None

lanspector.dashboard.data_prep.create_dashboard_tables(engine)[source]#

Create the normalized LANdash SQLite schema if tables do not already exist.

Parameters:
engine

SQLAlchemy 2.x engine pointing to the LANdash SQLite database.

Parameters:

engine (Engine)

Return type:

None

Neutral reusable Dash 3+ UI components and palette helpers for LANdash.

lanspector.dashboard.components.autoscale_bytes(value)[source]#

Determine the binary power-of-2 exponent and unit label for value bytes.

Parameters:
value

Byte count to scale.

Returns:
tuple[int, str]

Pair of (exponent, unit_label) such as (30, "GB").

Parameters:

value (float)

Return type:

tuple[int, str]

lanspector.dashboard.components.get_series_color(index)[source]#

Return a deterministic neutral hex color for series index.

Parameters:
index

Zero-based series index.

Returns:
str

Hex color string.

Parameters:

index (int)

Return type:

str

lanspector.dashboard.components.indicator_card(title, value, card_id=None)[source]#

Build a clean KPI card component for the LANdash executive summary row.

Parameters:
title

Descriptive label shown above the metric.

value

Formatted metric value.

card_id

Optional Dash component ID assigned to the value element.

Returns:
dash.html.Div

Styled KPI card div.

Parameters:
  • title (str)

  • value (Any)

  • card_id (str | None)

Return type:

Any

lanspector.dashboard.components.navbar(title='LANspector Dashboard')[source]#

Build a neutral top navigation bar for LANdash.

Parameters:
title

Header title displayed on the navigation bar.

Returns:
dash.html.Header

Styled header banner component.

Parameters:

title (str)

Return type:

Any

lanspector.dashboard.components.section_card(title, children, open_by_default=True)[source]#

Wrap children inside a native HTML <details> collapsible panel.

Parameters:
title

Section heading shown in the summary bar.

children

Dash components rendered inside the section body.

open_by_default

Whether the section starts expanded.

Returns:
dash.html.Details

Collapsible section container.

Parameters:
Return type:

Any

Modern Dash 3+ / Plotly 6+ LANdash web application (offline/air-gapped ready).

Replaces legacy Dash 0.42 + vendored React components (dash_sunburst, dash_network) with native Plotly plotly.graph_objects.Sunburst and plotly.graph_objects.Scatter network visualizations served locally (serve_locally=True) for restricted corporate LANs.

lanspector.dashboard.app.create_app(db_path)[source]#

Create and configure the LANdash dash.Dash application.

Parameters:
db_path

Path to a prepared LANdash SQLite database created via commit_data_to_database().

Returns:
dash.Dash

Configured Dash 3+ application ready to serve locally or via WSGI.

Parameters:

db_path (str | Path)

Return type:

Any

lanspector.dashboard.app.run_dashboard(settings)[source]#

Launch the LANdash web server from settings.

Parameters:
settings

Parsed CLI / configuration settings for lanspector dashboard.

Returns:
int

Exit status code (0 on clean shutdown, 1 if DB is missing).

Parameters:

settings (DashboardServeSettings)

Return type:

int

lanspector.dashboard.app.build_acl_network_figure(members_df)[source]#

Render an interactive Plotly graph of ACL groups connected to their members.

Parameters:
members_df

DataFrame returned by get_acl_membership().

Returns:
plotly.graph_objects.Figure

Plotly scatter/edge network figure.

Parameters:

members_df (DataFrame)

Return type:

Figure

lanspector.dashboard.app.build_dashboard_sunburst_figure(burst_df)[source]#

Build a native Plotly go.Sunburst figure from dashburst rows.

Parameters:
burst_df

DataFrame returned by load_sunburst_data().

Returns:
plotly.graph_objects.Figure

Interactive Plotly Sunburst figure.

Parameters:

burst_df (DataFrame)

Return type:

Figure

lanspector.dashboard.app.build_permission_pie_figure(snap_df)[source]#

Build a pie chart showing the breakdown of permission levels in the snapshot.

Parameters:
snap_df

Filtered parent-vs-child snapshot DataFrame.

Returns:
plotly.graph_objects.Figure

Plotly pie figure.

Parameters:

snap_df (DataFrame)

Return type:

Figure

lanspector.dashboard.app.build_timeline_figure(timeline_df)[source]#

Build a time-series line chart of permission diff counts by crawl date.

Parameters:
timeline_df

Parent-vs-child records across all available crawl dates.

Returns:
plotly.graph_objects.Figure

Plotly line chart grouped by permission code.

Parameters:

timeline_df (DataFrame)

Return type:

Figure