Allow AWUS wardriving network handoff
This commit is contained in:
1 parent
c3f8709690
commit
415492fafb
12 files changed
+147
-55
No files matched your search
@@ -175,7 +175,7 @@ Important values:
|
||||
- `WARDRIVING_ENABLED`: enables the opt-in Kismet session controller; the installer sets this to `true` on Raspberry Pi deployments
|
||||
- `WARDRIVING_KISMET_URL`: local Kismet API URL, normally `http://127.0.0.1:2501`
|
||||
- `WARDRIVING_ADAPTER_SELECTION_PATH`: service-owned persistent hardware selection, normally `/var/lib/pi-car-companion/wardriving-adapter-selection.json`
|
||||
- `WARDRIVING_WIFI_INTERFACE`: legacy dedicated monitor-mode WiFi interface override; when empty, the dashboard prefers a detected Alfa AWUS 1900 by USB identity and then another eligible WiFi adapter. The built-in `wlan0` hotspot and `wlan1` upstream radios are never commandeered.
|
||||
- `WARDRIVING_WIFI_INTERFACE`: legacy dedicated monitor-mode WiFi interface override; when empty, the dashboard prefers a detected Alfa AWUS 1900 by USB identity and then another eligible WiFi adapter. The built-in `wlan0` hotspot is never commandeered; selecting an AWUS 1900 currently used as `wlan1` performs a controlled upstream handoff for the session.
|
||||
- `WARDRIVING_BLUETOOTH_INTERFACE`: Bluetooth adapter used by Kismet, normally `hci0`
|
||||
- `WARDRIVING_POLL_SECONDS` / `WARDRIVING_MAX_SIGHTINGS`: Kismet polling interval and bounded observation retention
|
||||
|
||||
@@ -183,7 +183,7 @@ Important values:
|
||||
|
||||
The installer installs Kismet and a manually controlled `pi-car-companion-kismet.service`. It does not start capture at boot. Open **Wardriving** in the dashboard (or the Android companion), pair a phone, and start a session when the vehicle is parked or moving in a place where discovery is lawful. The official Kismet repository currently provides the required capture packages for 64-bit Raspberry Pi OS; the installer stops with an explicit architecture message on unsupported 32-bit images.
|
||||
|
||||
Use a dedicated USB WiFi adapter that supports monitor mode. The Wardriving screen lists live WiFi hardware, identifies USB adapters by vendor/model/path or serial, and marks the Alfa AWUS 1900 as the default when present. `wlan0` and `wlan1` remain locked to the car hotspot and upstream connection, so a selector entry for either is disabled. The selected hardware identity is persisted across interface renames and revalidated by the privileged Kismet helper before every start. Bluetooth capture uses the Pi's `hci0` adapter by default and Kismet's discoverable-device scan; a second Bluetooth adapter can be selected with `WARDRIVING_BLUETOOTH_INTERFACE` if the companion BLE link needs its own controller. It does not pair with devices or enumerate services. Kismet is configured for live device tracking without retaining raw packet payloads. Pi Car Companion stores bounded sightings and joins them to a phone GPS fix only while that fix is fresh and accurate. Observations without a suitable fix remain visible but are marked unmapped. The Android companion receives the same adapter inventory and can change the saved selection while a session is stopped.
|
||||
Use a dedicated USB WiFi adapter that supports monitor mode. The Wardriving screen lists live WiFi hardware, identifies USB adapters by vendor/model/path or serial, and marks the Alfa AWUS 1900 as the default when present. The built-in `wlan0` hotspot remains protected. If the AWUS 1900 is currently the `wlan1` upstream adapter, starting a session pauses the upstream NetworkManager controller and releases only that adapter for monitor capture; the phone-facing hotspot stays online, and stopping the session reconnects upstream and resumes the controller. The selected hardware identity is persisted across interface renames and revalidated by the privileged Kismet helper before every start. Bluetooth capture uses the Pi's `hci0` adapter by default and Kismet's discoverable-device scan; a second Bluetooth adapter can be selected with `WARDRIVING_BLUETOOTH_INTERFACE` if the companion BLE link needs its own controller. It does not pair with devices or enumerate services. Kismet is configured for live device tracking without retaining raw packet payloads. Pi Car Companion stores bounded sightings and joins them to a phone GPS fix only while that fix is fresh and accurate. Observations without a suitable fix remain visible but are marked unmapped. The Android companion receives the same adapter inventory and can change the saved selection while a session is stopped.
|
||||
|
||||
The UI exposes the active session, Kismet and GPS health, WiFi/Bluetooth counts, recent device metadata, a Leaflet map of mapped sightings, session controls, and data clearing. The Android app shows the same live summary over its existing Bluetooth bridge and can start or stop the session. Revoke a paired phone in **Settings → Mobile** to stop it contributing location data.
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ The Android app is a focused native companion rather than a copy of the web dash
|
||||
- live car speed, gear, steering, battery, range, and lifetime statistics;
|
||||
- launch access to ADB shortcuts that were explicitly saved in the web dashboard;
|
||||
- phone GPS, speed, bearing, accuracy, battery, and network-state uplink;
|
||||
- live WiFi/Bluetooth wardriving counts, GPS mapping health, recent devices, adapter selection, and start/stop/restart controls;
|
||||
- live WiFi/Bluetooth wardriving counts, GPS mapping health, recent devices, adapter selection, and start/stop/restart controls. Selecting the AWUS 1900 can temporarily pause upstream internet while the Pi hotspot remains available for the phone;
|
||||
- background BLE reconnection and location updates through a foreground service.
|
||||
|
||||
## Pairing
|
||||
|
||||
@@ -239,6 +239,7 @@ class CompanionRepository(private val context: Context) {
|
||||
interfaceName = adapter.optString("interface"),
|
||||
macAddress = adapter.optString("macAddress").takeIf { it.isNotBlank() },
|
||||
eligible = adapter.optBoolean("eligible", false),
|
||||
requiresNetworkHandoff = adapter.optBoolean("requiresNetworkHandoff", false),
|
||||
reason = adapter.optString("reason").takeIf { it.isNotBlank() },
|
||||
recommended = adapter.optBoolean("recommended", false),
|
||||
connected = adapter.optBoolean("connected", false)
|
||||
|
||||
@@ -149,14 +149,14 @@ class MainActivity : ComponentActivity() {
|
||||
DropdownMenu(expanded = adapterMenuOpen, onDismissRequest = { adapterMenuOpen = false }) {
|
||||
radio?.adapters?.forEach { adapter ->
|
||||
DropdownMenuItem(
|
||||
text = { Column { Text(if (adapter.recommended) "${adapter.label} · Recommended" else adapter.label); Text(if (adapter.eligible) "${adapter.interfaceName}${if (adapter.connected) " · connected" else ""}" else adapter.reason ?: "Unavailable", color = Muted, fontSize = 11.sp) } },
|
||||
text = { Column { Text(if (adapter.recommended) "${adapter.label} · Recommended" else adapter.label); Text(if (adapter.eligible) "${adapter.interfaceName}${if (adapter.connected) " · connected" else ""}${if (adapter.requiresNetworkHandoff) " · pauses upstream" else ""}" else adapter.reason ?: "Unavailable", color = Muted, fontSize = 11.sp) } },
|
||||
enabled = adapter.eligible,
|
||||
onClick = { adapterMenuOpen = false; selectAdapter(adapter.id) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Text(selectedAdapter?.let { "${it.interfaceName} · ${it.macAddress ?: "MAC unavailable"}" } ?: "Hotspot and upstream radios stay reserved for the car network.", color = Muted, fontSize = 11.sp, lineHeight = 17.sp, modifier = Modifier.padding(top = 7.dp))
|
||||
Text(selectedAdapter?.let { "${it.interfaceName} · ${it.macAddress ?: "MAC unavailable"}${if (it.requiresNetworkHandoff) " · upstream pauses during capture" else ""}" } ?: "The Pi hotspot remains available for phone GPS while capture runs.", color = Muted, fontSize = 11.sp, lineHeight = 17.sp, modifier = Modifier.padding(top = 7.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ data class WardrivingAdapter(
|
||||
val interfaceName: String,
|
||||
val macAddress: String?,
|
||||
val eligible: Boolean,
|
||||
val requiresNetworkHandoff: Boolean,
|
||||
val reason: String?,
|
||||
val recommended: Boolean,
|
||||
val connected: Boolean
|
||||
|
||||
Binary file not shown.
@@ -17,8 +17,11 @@ esac
|
||||
|
||||
ENV_FILE=/etc/pi-car-companion/companion.env
|
||||
SERVICE=pi-car-companion-kismet.service
|
||||
NETWORK_SERVICE=pi-car-companion-network.service
|
||||
CONFIG=/etc/kismet/kismet_site.conf
|
||||
STATE_DIR=/var/lib/pi-car-companion
|
||||
DATA_DIR=/var/lib/pi-car-companion/kismet
|
||||
HANDOFF_MARKER="${STATE_DIR}/wardriving-network-handoff"
|
||||
|
||||
if [[ -f "${ENV_FILE}" ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
@@ -32,10 +35,25 @@ wifi_interface="${WARDRIVING_WIFI_INTERFACE:-}"
|
||||
bluetooth_interface="${WARDRIVING_BLUETOOTH_INTERFACE-hci0}"
|
||||
hotspot_interface="${NETWORK_HOTSPOT_INTERFACE:-wlan0}"
|
||||
upstream_interface="${NETWORK_UPSTREAM_INTERFACE:-wlan1}"
|
||||
network_handoff=false
|
||||
|
||||
is_protected_interface() {
|
||||
is_hotspot_interface() {
|
||||
local interface_name="$1"
|
||||
[[ "${interface_name}" == "${hotspot_interface}" || "${interface_name}" == "${upstream_interface}" || "${interface_name}" == "wlan0" || "${interface_name}" == "wlan1" ]]
|
||||
[[ "${interface_name}" == "${hotspot_interface}" || "${interface_name}" == "wlan0" ]]
|
||||
}
|
||||
|
||||
is_upstream_interface() {
|
||||
local interface_name="$1"
|
||||
[[ "${interface_name}" == "${upstream_interface}" || "${interface_name}" == "wlan1" ]]
|
||||
}
|
||||
|
||||
is_capture_reserved_interface() {
|
||||
local interface_name="$1"
|
||||
is_hotspot_interface "${interface_name}" && return 0
|
||||
if is_upstream_interface "${interface_name}" && ! is_awus1900 "${interface_name}"; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
udev_property() {
|
||||
@@ -82,58 +100,64 @@ wifi_candidates() {
|
||||
} | sort -u
|
||||
}
|
||||
|
||||
if [[ -f "${SELECTION_PATH}" ]]; then
|
||||
selected_adapter_id="$(sed -n 's/.*"adapterId"[[:space:]]*:[[:space:]]*"\([a-zA-Z0-9._:./-]*\)".*/\1/p' "${SELECTION_PATH}" | head -n 1)"
|
||||
selected_mac="$(sed -n 's/.*"macAddress"[[:space:]]*:[[:space:]]*"\([0-9A-Fa-f:]*\)".*/\1/p' "${SELECTION_PATH}" | head -n 1 | tr '[:upper:]' '[:lower:]')"
|
||||
if [[ -z "${selected_adapter_id}" || -z "${selected_mac}" || ! "${selected_mac}" =~ ^[0-9a-f]{2}(:[0-9a-f]{2}){5}$ ]]; then
|
||||
echo "The saved wardriving adapter selection is invalid." >&2
|
||||
exit 1
|
||||
fi
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_protected_interface "${candidate}" && continue
|
||||
candidate_mac="$(cat "/sys/class/net/${candidate}/address" 2>/dev/null || true)"
|
||||
candidate_id="$(adapter_id "${candidate}")"
|
||||
if [[ "${candidate_id}" == "${selected_adapter_id}" && "${candidate_mac,,}" == "${selected_mac}" ]]; then
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
if [[ "${ACTION}" != "stop" ]]; then
|
||||
if [[ -f "${SELECTION_PATH}" ]]; then
|
||||
selected_adapter_id="$(sed -n 's/.*"adapterId"[[:space:]]*:[[:space:]]*"\([a-zA-Z0-9._:./-]*\)".*/\1/p' "${SELECTION_PATH}" | head -n 1)"
|
||||
selected_mac="$(sed -n 's/.*"macAddress"[[:space:]]*:[[:space:]]*"\([0-9A-Fa-f:]*\)".*/\1/p' "${SELECTION_PATH}" | head -n 1 | tr '[:upper:]' '[:lower:]')"
|
||||
if [[ -z "${selected_adapter_id}" || -z "${selected_mac}" || ! "${selected_mac}" =~ ^[0-9a-f]{2}(:[0-9a-f]{2}){5}$ ]]; then
|
||||
echo "The saved wardriving adapter selection is invalid." >&2
|
||||
exit 1
|
||||
fi
|
||||
done < <(wifi_candidates)
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_capture_reserved_interface "${candidate}" && continue
|
||||
candidate_mac="$(cat "/sys/class/net/${candidate}/address" 2>/dev/null || true)"
|
||||
candidate_id="$(adapter_id "${candidate}")"
|
||||
if [[ "${candidate_id}" == "${selected_adapter_id}" && "${candidate_mac,,}" == "${selected_mac}" ]]; then
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
fi
|
||||
done < <(wifi_candidates)
|
||||
if [[ -z "${wifi_interface}" ]]; then
|
||||
echo "The saved wardriving adapter is not present or reserved for networking." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${wifi_interface}" ]]; then
|
||||
echo "The saved wardriving adapter is not present or is reserved for networking." >&2
|
||||
exit 1
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_capture_reserved_interface "${candidate}" && continue
|
||||
if is_awus1900 "${candidate}"; then
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
fi
|
||||
done < <(wifi_candidates)
|
||||
fi
|
||||
|
||||
if [[ -z "${wifi_interface}" ]]; then
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_capture_reserved_interface "${candidate}" && continue
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
done < <(wifi_candidates)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${wifi_interface}" ]]; then
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_protected_interface "${candidate}" && continue
|
||||
if is_awus1900 "${candidate}"; then
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
fi
|
||||
done < <(wifi_candidates)
|
||||
if [[ "${ACTION}" != "stop" && -n "${wifi_interface}" ]] && is_upstream_interface "${wifi_interface}" && is_awus1900 "${wifi_interface}"; then
|
||||
network_handoff=true
|
||||
fi
|
||||
|
||||
if [[ -z "${wifi_interface}" ]]; then
|
||||
while IFS= read -r candidate; do
|
||||
[[ -n "${candidate}" && "${candidate}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || continue
|
||||
is_protected_interface "${candidate}" && continue
|
||||
wifi_interface="${candidate}"
|
||||
break
|
||||
done < <(wifi_candidates)
|
||||
fi
|
||||
|
||||
if [[ -n "${wifi_interface}" && ! "${wifi_interface}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]] || [[ -n "${bluetooth_interface}" && ! "${bluetooth_interface}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]]; then
|
||||
if [[ "${ACTION}" != "stop" && ( ( -n "${wifi_interface}" && ! "${wifi_interface}" =~ ^[a-zA-Z0-9._-]{1,64}$ ) || ( -n "${bluetooth_interface}" && ! "${bluetooth_interface}" =~ ^[a-zA-Z0-9._-]{1,64}$ ) ) ]]; then
|
||||
echo "Wardriving interfaces contain unsupported characters." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "${wifi_interface}" && ! -e "/sys/class/net/${wifi_interface}/wireless" ]]; then
|
||||
if [[ "${ACTION}" != "stop" && -n "${wifi_interface}" && ! -e "/sys/class/net/${wifi_interface}/wireless" ]]; then
|
||||
echo "The selected wardriving interface is not a WiFi adapter." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "${wifi_interface}" ]] && is_protected_interface "${wifi_interface}"; then
|
||||
if [[ "${ACTION}" != "stop" && -n "${wifi_interface}" ]] && is_capture_reserved_interface "${wifi_interface}"; then
|
||||
echo "Wardriving cannot use the hotspot or upstream WiFi interface (${wifi_interface})." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -192,17 +216,71 @@ stop_bluetooth_discovery() {
|
||||
btmgmt --index "${bluetooth_interface#hci}" stop-discovery >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
prepare_network_handoff() {
|
||||
[[ "${network_handoff}" == true ]] || return
|
||||
if [[ -f "${HANDOFF_MARKER}" ]]; then
|
||||
return
|
||||
fi
|
||||
local network_was_active=false
|
||||
if systemctl is-active --quiet "${NETWORK_SERVICE}"; then
|
||||
network_was_active=true
|
||||
fi
|
||||
install -d -m 0750 -o root -g pi-companion "${STATE_DIR}"
|
||||
printf '%s\n%s\n' "${wifi_interface}" "${network_was_active}" > "${HANDOFF_MARKER}"
|
||||
chmod 0600 "${HANDOFF_MARKER}"
|
||||
chown root:pi-companion "${HANDOFF_MARKER}"
|
||||
systemctl stop "${NETWORK_SERVICE}" >/dev/null 2>&1 || true
|
||||
if ! nmcli device set "${wifi_interface}" managed no; then
|
||||
return 1
|
||||
fi
|
||||
nmcli device disconnect "${wifi_interface}" >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
restore_network_handoff() {
|
||||
[[ -f "${HANDOFF_MARKER}" ]] || return
|
||||
local handoff_interface network_was_active
|
||||
handoff_interface="$(sed -n '1p' "${HANDOFF_MARKER}" | tr -d '\r\n')"
|
||||
network_was_active="$(sed -n '2p' "${HANDOFF_MARKER}")"
|
||||
if [[ ! "${handoff_interface}" =~ ^[a-zA-Z0-9._-]{1,64}$ ]]; then
|
||||
rm -f -- "${HANDOFF_MARKER}"
|
||||
return
|
||||
fi
|
||||
nmcli device set "${handoff_interface}" managed yes >/dev/null 2>&1 || true
|
||||
nmcli device connect "${handoff_interface}" >/dev/null 2>&1 || true
|
||||
if [[ "${network_was_active}" == true ]]; then
|
||||
systemctl start "${NETWORK_SERVICE}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
rm -f -- "${HANDOFF_MARKER}"
|
||||
}
|
||||
|
||||
case "${ACTION}" in
|
||||
start)
|
||||
write_config
|
||||
systemctl start "${SERVICE}"
|
||||
if ! prepare_network_handoff; then
|
||||
restore_network_handoff
|
||||
exit 1
|
||||
fi
|
||||
if ! systemctl start "${SERVICE}"; then
|
||||
restore_network_handoff
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
systemctl stop "${SERVICE}"
|
||||
stop_status=0
|
||||
systemctl stop "${SERVICE}" || stop_status=$?
|
||||
stop_bluetooth_discovery
|
||||
restore_network_handoff
|
||||
exit "${stop_status}"
|
||||
;;
|
||||
restart)
|
||||
write_config
|
||||
systemctl restart "${SERVICE}"
|
||||
if ! prepare_network_handoff; then
|
||||
restore_network_handoff
|
||||
exit 1
|
||||
fi
|
||||
if ! systemctl restart "${SERVICE}"; then
|
||||
restore_network_handoff
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -64,6 +64,7 @@ export type WardrivingAdapter = {
|
||||
connection: string | null;
|
||||
connected: boolean;
|
||||
eligible: boolean;
|
||||
requiresNetworkHandoff: boolean;
|
||||
reason: string | null;
|
||||
recommended: boolean;
|
||||
label: string;
|
||||
@@ -300,9 +301,12 @@ export async function discoverWardrivingAdapters(config: WardrivingConfig): Prom
|
||||
const vendorId = properties.ID_VENDOR_ID?.trim().toLowerCase();
|
||||
const modelId = properties.ID_MODEL_ID?.trim().toLowerCase();
|
||||
const usbId = vendorId && modelId ? `${vendorId}:${modelId}` : null;
|
||||
const protectedReason = isProtectedWardrivingInterface(interfaceName, config);
|
||||
const awus = isAwus1900(properties, driver, usbId);
|
||||
const eligible = macAddress !== null && protectedReason === null;
|
||||
const protectedReason = isProtectedWardrivingInterface(interfaceName, config);
|
||||
const hotspotConflict = interfaceName === config.hotspotInterface || interfaceName === "wlan0";
|
||||
const upstreamConflict = interfaceName === config.upstreamInterface || interfaceName === "wlan1";
|
||||
const requiresNetworkHandoff = upstreamConflict && awus;
|
||||
const eligible = macAddress !== null && !hotspotConflict && (protectedReason === null || requiresNetworkHandoff);
|
||||
const state = networkState.get(interfaceName);
|
||||
return {
|
||||
id: macAddress ? stableAdapterId(properties, macAddress) : `interface:${interfaceName}`,
|
||||
@@ -315,7 +319,12 @@ export async function discoverWardrivingAdapters(config: WardrivingConfig): Prom
|
||||
connection: state?.connection ?? null,
|
||||
connected: state?.connected ?? false,
|
||||
eligible,
|
||||
reason: protectedReason ?? (macAddress ? null : "The adapter has no stable MAC address"),
|
||||
requiresNetworkHandoff,
|
||||
reason: hotspotConflict
|
||||
? "Reserved for the Pi hotspot"
|
||||
: requiresNetworkHandoff
|
||||
? "Temporarily pauses upstream internet while wardriving"
|
||||
: protectedReason ?? (macAddress ? null : "The adapter has no stable MAC address"),
|
||||
recommended: awus,
|
||||
label: adapterLabel(interfaceName, properties, driver, awus)
|
||||
} satisfies WardrivingAdapter;
|
||||
|
||||
@@ -13,6 +13,7 @@ const adapter = (overrides: Partial<WardrivingAdapter> = {}): WardrivingAdapter
|
||||
connection: null,
|
||||
connected: false,
|
||||
eligible: true,
|
||||
requiresNetworkHandoff: false,
|
||||
reason: null,
|
||||
recommended: true,
|
||||
label: "Alfa AWUS 1900 (wlan2)",
|
||||
|
||||
@@ -148,12 +148,12 @@ export function WardrivingPage({ csrfToken }: { csrfToken: string }) {
|
||||
<label htmlFor="wardriving-wifi-adapter">WiFi monitor adapter</label>
|
||||
<select id="wardriving-wifi-adapter" value={snapshot?.selectedWifiAdapterId ?? ""} disabled={snapshot?.running || busy !== null || !snapshot?.wifiAdapters.length} onChange={(event) => { if (event.target.value) void selectAdapter(event.target.value); }}>
|
||||
<option value="">{snapshot?.wifiAdapters.length ? "Select a WiFi adapter" : "No WiFi adapters detected"}</option>
|
||||
{(snapshot?.wifiAdapters ?? []).map((adapter) => <option key={adapter.id} value={adapter.id} disabled={!adapter.eligible}>{adapter.label}{adapter.recommended ? " · Recommended" : ""}{!adapter.eligible ? ` · ${adapter.reason ?? "Unavailable"}` : ""}</option>)}
|
||||
{(snapshot?.wifiAdapters ?? []).map((adapter) => <option key={adapter.id} value={adapter.id} disabled={!adapter.eligible}>{adapter.label}{adapter.recommended ? " · Recommended" : ""}{adapter.requiresNetworkHandoff ? " · Pauses upstream" : ""}{!adapter.eligible ? ` · ${adapter.reason ?? "Unavailable"}` : ""}</option>)}
|
||||
</select>
|
||||
{selectedAdapter ? <p className="wardriving-adapter-detail"><strong>{selectedAdapter.label}</strong><span>{selectedAdapter.interface} · {selectedAdapter.macAddress ?? "MAC unavailable"}{selectedAdapter.connected ? " · connected" : ""}</span></p> : <p className="wardriving-adapter-detail">{recommendedAdapter ? `${recommendedAdapter.label} is detected, but it is unavailable: ${recommendedAdapter.reason ?? "reserved for networking"}.` : "The Alfa AWUS 1900 is preferred automatically when it is available."} Hotspot and upstream radios stay locked to the car network.</p>}
|
||||
{selectedAdapter ? <p className="wardriving-adapter-detail"><strong>{selectedAdapter.label}</strong><span>{selectedAdapter.interface} · {selectedAdapter.macAddress ?? "MAC unavailable"}{selectedAdapter.connected ? " · connected" : ""}</span>{selectedAdapter.requiresNetworkHandoff && <em>Starting will pause upstream internet while keeping the Pi hotspot available for the phone.</em>}</p> : <p className="wardriving-adapter-detail">{recommendedAdapter ? `${recommendedAdapter.label} is detected, but it is unavailable: ${recommendedAdapter.reason ?? "reserved for networking"}.` : "The Alfa AWUS 1900 is preferred automatically when it is available."} The hotspot radio stays protected.</p>}
|
||||
</div>
|
||||
<dl className="wardriving-source-list"><div><dt>WiFi adapter</dt><dd><WifiHigh size={18} />{snapshot?.sources.wifiInterface ?? "Auto-select"}</dd></div><div><dt>Bluetooth adapter</dt><dd><Bluetooth size={18} />{snapshot?.sources.bluetoothInterface ?? "Not configured"}</dd></div><div><dt>Capture mode</dt><dd><ShieldCheck size={18} />WiFi passive · BT discoverable</dd></div></dl>
|
||||
<p className="wardriving-note">Kismet uses passive WiFi capture and a discoverable-device Bluetooth scan. It does not pair, enumerate services, or access payloads. Adapters reserved for the Pi hotspot or upstream connection are shown but cannot be selected.</p>
|
||||
<p className="wardriving-note">Kismet uses passive WiFi capture and a discoverable-device Bluetooth scan. It does not pair, enumerate services, or access payloads. The AWUS 1900 can be handed off from upstream for a session; the Pi hotspot remains available for live phone GPS and statistics, and upstream is restored when capture stops.</p>
|
||||
</div>
|
||||
<div className="wardriving-source-panel">
|
||||
<div className="wardriving-panel-heading"><div><h2>Data controls</h2><p>{snapshot?.statistics.sessions ?? 0} sessions · bounded to 250,000 sightings.</p></div><Trash size={24} /></div>
|
||||
|
||||
@@ -160,6 +160,7 @@ export type WardrivingAdapter = {
|
||||
connection: string | null;
|
||||
connected: boolean;
|
||||
eligible: boolean;
|
||||
requiresNetworkHandoff: boolean;
|
||||
reason: string | null;
|
||||
recommended: boolean;
|
||||
label: string;
|
||||
|
||||
@@ -369,6 +369,7 @@ button:disabled { opacity: 0.55; cursor: not-allowed; }
|
||||
.wardriving-adapter-detail { display: grid; gap: 4px; margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
|
||||
.wardriving-adapter-detail strong { overflow: hidden; color: var(--text); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.wardriving-adapter-detail span { overflow: hidden; font-family: ui-monospace, "Cascadia Code", monospace; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.wardriving-adapter-detail em { color: var(--accent); font-size: .68rem; font-style: normal; line-height: 1.4; }
|
||||
.wardriving-source-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0 0; }
|
||||
.wardriving-source-list div { display: grid; gap: 8px; min-width: 0; }
|
||||
.wardriving-source-list dt { color: var(--muted); font-size: .72rem; }
|
||||
|
||||
Reference in new issue
Block a user