16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193 | def render_about(
*,
app_name: str,
app_version: str,
app_author: str,
snapshot: Any | None = None,
is_docker: bool,
) -> list[Any]:
"""Render About view content.
Read snapshot["app_info"] only and avoid network calls.
"""
app_info: dict[str, Any] = {}
if isinstance(snapshot, dict):
info = snapshot.get("app_info")
if isinstance(info, dict):
app_info = info
server_host_val = app_info.get("server_host")
server_host = server_host_val if isinstance(server_host_val, str) else "-"
server_port = app_info.get("server_port")
poll_ms = app_info.get("poll_interval_ms")
coord_precision = app_info.get("coord_precision")
near_km = app_info.get("zoom_near_km")
geoinfo_enabled = bool(app_info.get("geoinfo_enabled", False))
geo_provider = str(app_info.get("geo_provider") or "-")
geo_database_date = str(app_info.get("geo_database_date") or "-")
provider_label = {
"maxmind": "MaxMind GeoLite2",
"dbip": "DB-IP Lite",
"none": "None",
}.get(geo_provider, geo_provider)
myloc_mode_val = app_info.get("myloc_mode")
myloc_mode = myloc_mode_val if isinstance(myloc_mode_val, str) else "OFF"
my_location = app_info.get("my_location")
public_ip_cached = app_info.get("public_ip_cached")
public_ip_cached = (
public_ip_cached if isinstance(public_ip_cached, str) and public_ip_cached else None
)
auto_geo_cached = app_info.get("auto_geo_cached")
auto_geo = auto_geo_cached if isinstance(auto_geo_cached, dict) else {}
os_text = app_info.get("os") if isinstance(app_info.get("os"), str) else "-"
py_text = app_info.get("python") if isinstance(app_info.get("python"), str) else "-"
net_backend_val = app_info.get("net_backend")
net_backend = net_backend_val if isinstance(net_backend_val, str) else "-"
net_backend_version_val = app_info.get("net_backend_version")
net_backend_version = (
net_backend_version_val if isinstance(net_backend_version_val, str) else "-"
)
tapmap_rows: list[tuple[str, str]] = [
("Name", app_name),
("Version", app_version),
("Author", app_author),
("Server port", str(server_port) if isinstance(server_port, int) else "-"),
("Poll interval", f"{poll_ms} ms" if isinstance(poll_ms, int) else "-"),
("Coord precision", str(coord_precision) if coord_precision is not None else "-"),
("Near distance", f"{near_km} km" if isinstance(near_km, (int, float)) else "-"),
]
geo_rows: list[tuple[str, str]] = [
("Geolocation", "Enabled" if geoinfo_enabled else "Disabled"),
("Databases", provider_label),
("Database date", geo_database_date if geo_database_date else "-"),
]
location_rows = _build_location_rows(
myloc_mode=myloc_mode,
my_location=my_location,
public_ip_cached=public_ip_cached,
auto_geo=auto_geo,
)
runtime_rows: list[tuple[str, str]] = [
("OS", os_text),
("Python", py_text),
("Network backend", net_backend),
("Backend version", net_backend_version),
("Server host", server_host),
("Docker", "Yes" if is_docker else "No"),
]
return [
html.H1(f"About {app_name}"),
html.P(
"TapMap inspects local socket activity, enriches IP addresses with "
"geolocation, visualizes connections on an interactive map, and "
"builds insights from the most recent 30 days of activity."
),
html.P(
"Historical insights include recurring activity patterns, provider "
"distribution, country activity and generated activity logs."
),
html.P(
"It reads active socket data using a platform-specific backend, "
"local GeoIP databases for geolocation, "
"and Dash with Plotly for visualization."
),
html.P("Runs locally. No telemetry. TapMap does not inspect traffic contents."),
kv_table(tapmap_rows),
html.H2("Command line"),
html.Pre(
"tapmap Start application\n"
"tapmap --help Show options\n"
"tapmap --version Show version"
),
html.H2("Geolocation"),
html.P(
"Geolocation uses locally installed MaxMind GeoLite2 or DB-IP Lite .mmdb databases."
),
kv_table(geo_rows),
html.P(
[
"IP Geolocation by ",
html.A(
"DB-IP",
href="https://db-ip.com",
target="_blank",
rel="noopener noreferrer",
),
]
) if geo_provider == "dbip" else None,
html.P(
[
"This product includes GeoLite Data created by MaxMind, available from ",
html.A(
"https://www.maxmind.com",
href="https://www.maxmind.com",
target="_blank",
rel="noopener noreferrer",
),
".",
]
) if geo_provider == "maxmind" else None,
html.H2("Location"),
kv_table(location_rows),
html.H2("Runtime"),
kv_table(runtime_rows),
html.H2("Project"),
html.P(
"TapMap is free, open source, and available on GitHub and Docker Hub."
),
html.Ul(
[
html.Li(
html.A(
"GitHub repository",
href="https://github.com/olalie/tapmap",
target="_blank",
rel="noopener noreferrer",
)
),
html.Li(
html.A(
"Docker Hub image",
href="https://hub.docker.com/r/olalie/tapmap",
target="_blank",
rel="noopener noreferrer",
)
),
html.Li(
html.A(
"Buy Me a Coffee",
href="https://www.buymeacoffee.com/olalie",
target="_blank",
rel="noopener noreferrer",
)
),
]
),
]
|