Update public source
This commit is contained in:
@@ -15,7 +15,7 @@ from reports.template import (
|
|||||||
page_begin,
|
page_begin,
|
||||||
page_end,
|
page_end,
|
||||||
)
|
)
|
||||||
|
from reports.map_popups import build_standard_popup
|
||||||
|
|
||||||
def esc(value):
|
def esc(value):
|
||||||
return html.escape("" if value is None else str(value), quote=True)
|
return html.escape("" if value is None else str(value), quote=True)
|
||||||
@@ -604,6 +604,7 @@ def load_access_point(conn, bssid):
|
|||||||
cipher,
|
cipher,
|
||||||
akm,
|
akm,
|
||||||
country,
|
country,
|
||||||
|
vendor,
|
||||||
channel,
|
channel,
|
||||||
frequency,
|
frequency,
|
||||||
vendor,
|
vendor,
|
||||||
@@ -669,6 +670,25 @@ def load_credentials(conn, access_point_id):
|
|||||||
(access_point_id,),
|
(access_point_id,),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def load_handshakes(conn, access_point_id):
|
||||||
|
return query_all(
|
||||||
|
conn,
|
||||||
|
"""
|
||||||
|
SELECT
|
||||||
|
session_id,
|
||||||
|
type,
|
||||||
|
captured_at
|
||||||
|
FROM handshakes
|
||||||
|
WHERE
|
||||||
|
access_point_id = ?
|
||||||
|
AND session_id IS NOT NULL
|
||||||
|
ORDER BY
|
||||||
|
session_id,
|
||||||
|
captured_at DESC,
|
||||||
|
id DESC
|
||||||
|
""",
|
||||||
|
(access_point_id,),
|
||||||
|
)
|
||||||
|
|
||||||
def security_text(ap):
|
def security_text(ap):
|
||||||
values = []
|
values = []
|
||||||
@@ -736,6 +756,28 @@ def build_geojson(observations, ellipse=None, zones=None):
|
|||||||
"rssi": item["rssi"],
|
"rssi": item["rssi"],
|
||||||
"speed": item["speed"],
|
"speed": item["speed"],
|
||||||
"map_status": item.get("map_status", "normal"),
|
"map_status": item.get("map_status", "normal"),
|
||||||
|
"popup": build_standard_popup(
|
||||||
|
essid=item["essid"],
|
||||||
|
bssid=item["bssid"],
|
||||||
|
vendor=item["vendor"],
|
||||||
|
encryption=item["encryption"],
|
||||||
|
cipher=item["cipher"],
|
||||||
|
akm=item["akm"],
|
||||||
|
channel=item["channel"],
|
||||||
|
rssi=item["rssi"],
|
||||||
|
passwords=item["passwords"],
|
||||||
|
handshakes=item["handshakes"],
|
||||||
|
observed_at=format_datetime(
|
||||||
|
item["observed_at"]
|
||||||
|
),
|
||||||
|
latitude=latitude,
|
||||||
|
longitude=longitude,
|
||||||
|
session_url=(
|
||||||
|
f"/reports/session/{item['session_id']}"
|
||||||
|
if item["session_id"] is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
features.append(
|
features.append(
|
||||||
@@ -970,15 +1012,7 @@ def render_map(geojson, context, title):
|
|||||||
|
|
||||||
new maplibregl.Popup()
|
new maplibregl.Popup()
|
||||||
.setLngLat(e.lngLat)
|
.setLngLat(e.lngLat)
|
||||||
.setHTML(
|
.setHTML(p.popup || "Нет информации")
|
||||||
"<strong>Наблюдение</strong><br>" +
|
|
||||||
"Дата: " + escapeHtml(p.observed_at) + "<br>" +
|
|
||||||
"Сессия: <a href=\\"/reports/session/" +
|
|
||||||
encodeURIComponent(p.session_id) + "\\">" +
|
|
||||||
escapeHtml(p.session_id) + "</a><br>" +
|
|
||||||
"RSSI: " + escapeHtml(p.rssi ?? "—") + "<br>" +
|
|
||||||
"Скорость: " + escapeHtml(p.speed ?? "—")
|
|
||||||
)
|
|
||||||
.addTo(map);
|
.addTo(map);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
@@ -1162,6 +1196,26 @@ def render_access_point_page(
|
|||||||
observations_raw = load_observations(conn, ap["id"])
|
observations_raw = load_observations(conn, ap["id"])
|
||||||
observations = valid_observations(observations_raw)
|
observations = valid_observations(observations_raw)
|
||||||
credentials = load_credentials(conn, ap["id"])
|
credentials = load_credentials(conn, ap["id"])
|
||||||
|
handshakes = load_handshakes(conn, ap["id"])
|
||||||
|
|
||||||
|
handshakes_by_session = defaultdict(list)
|
||||||
|
|
||||||
|
for handshake in handshakes:
|
||||||
|
handshakes_by_session[
|
||||||
|
handshake["session_id"]
|
||||||
|
].append({
|
||||||
|
"type": handshake["type"],
|
||||||
|
"captured_at": handshake["captured_at"],
|
||||||
|
})
|
||||||
|
|
||||||
|
popup_credentials = [
|
||||||
|
{
|
||||||
|
"password": credential["password"],
|
||||||
|
"source": credential["source"],
|
||||||
|
"verified": credential["verified"],
|
||||||
|
}
|
||||||
|
for credential in credentials
|
||||||
|
]
|
||||||
|
|
||||||
if ap["is_cracked"]:
|
if ap["is_cracked"]:
|
||||||
map_status = "cracked"
|
map_status = "cracked"
|
||||||
@@ -1174,7 +1228,16 @@ def render_access_point_page(
|
|||||||
|
|
||||||
for item in observations:
|
for item in observations:
|
||||||
map_item = dict(item)
|
map_item = dict(item)
|
||||||
|
|
||||||
map_item["map_status"] = map_status
|
map_item["map_status"] = map_status
|
||||||
|
map_item["bssid"] = ap["bssid"]
|
||||||
|
map_item["vendor"] = ap["vendor"]
|
||||||
|
map_item["passwords"] = popup_credentials
|
||||||
|
map_item["handshakes"] = handshakes_by_session.get(
|
||||||
|
item["session_id"],
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
|
||||||
map_observations.append(map_item)
|
map_observations.append(map_item)
|
||||||
|
|
||||||
statistics = calculate_statistics(observations_raw)
|
statistics = calculate_statistics(observations_raw)
|
||||||
|
|||||||
Reference in New Issue
Block a user