housekeeping: MIT license, region note, refresh-state restore

- LICENSE: MIT (closes #24). Chosen so forks can iterate freely; upstream
  research credits in README should be preserved.
- README: adds a short "Region" callout noting Flock is US-first, so
  users outside North America know why the OUI list may not match
  anything locally (closes #6).
- Dashboard: fix state restoration on page refresh (closes #46).
  loadStatus() now injects the connected port back into the dropdown,
  locks the port controls, hides the refresh button, and for gpsd
  repopulates the host:port inputs from the reported endpoint.
  updateFlockStatus/updateGpsStatus centralize the connected/idle
  toggles (dot + buttons + control lock + extra controls) so all
  entry points converge.
This commit is contained in:
Colonel Panic
2026-07-29 11:50:17 -04:00
parent 75c269ebf6
commit 48d3f1fa9c
3 changed files with 115 additions and 21 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 colonelpanichacks
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+8
View File
@@ -6,6 +6,8 @@
This is the `main` branch — stable line. Development happens on `promiscious-dev`, which adds the DeFlockJoplin Information Element research and wildcard-probe signature on top of this baseline. See "Further research" below.
> **Region:** Flock Safety hardware is deployed primarily in the United States (and to a lesser extent Canada). If you're outside North America the OUI list and probe-request signatures here won't match anything — the tool is still useful for research, but it's not going to find infrastructure that isn't there.
---
## Credit
@@ -299,6 +301,12 @@ Flock-You is part of the OUI-SPY firmware family:
---
## License
MIT — see [`LICENSE`](LICENSE). Free to fork, modify, and redistribute; upstream research credits above should be preserved.
---
## Disclaimer
Passive reception of publicly-broadcast 802.11 frames for security research, privacy auditing, and education. The device does not transmit and does not authenticate to any network. Detecting the presence of surveillance hardware in public spaces is legal in most jurisdictions; always comply with local laws regarding wireless reception.
+86 -21
View File
@@ -1889,24 +1889,62 @@
});
}
// Inject a value into a <select> as a fresh option if it isn't
// already present, then select it. Used on page-load status
// restoration so a connected port shows up in the dropdown even
// when the port list refresh hasn't run yet (or the device has
// dropped off `list_ports`).
function ensureSelectHasValue(selectEl, value, labelFallback) {
if (!selectEl || !value) return;
const has = Array.from(selectEl.options).some(o => o.value === value);
if (!has) {
const opt = document.createElement('option');
opt.value = value;
opt.textContent = labelFallback || value;
selectEl.appendChild(opt);
}
selectEl.value = value;
}
// Freeze or unfreeze the Sniffer / GPS port controls so they can't
// be edited while a device is live. Also hides the refresh button
// during connection to keep the auto-refresh loop from clobbering
// the shown value.
function setFlockControlsLocked(locked) {
const sel = document.getElementById('flockDeviceSelect');
const refresh = document.getElementById('refreshFlockPortsBtn');
if (sel) sel.disabled = locked;
if (refresh) refresh.style.display = locked ? 'none' : '';
}
function setGpsControlsLocked(locked) {
const source = document.getElementById('gpsSourceSelect');
const portSel = document.getElementById('gpsPortSelect');
const refresh = document.getElementById('refreshGpsPortsBtn');
const host = document.getElementById('gpsdHostInput');
const port = document.getElementById('gpsdPortInput');
if (source) source.disabled = locked;
if (portSel) portSel.disabled = locked;
if (host) host.disabled = locked;
if (port) port.disabled = locked;
if (refresh) refresh.style.display = locked ? 'none' : '';
}
function updateFlockStatus(connected) {
const indicator = document.getElementById('flockStatus');
if (connected) {
indicator.classList.add('active');
} else {
indicator.classList.remove('active');
}
if (indicator) indicator.classList.toggle('active', !!connected);
document.getElementById('connectFlockBtn').style.display = connected ? 'none' : 'inline-block';
document.getElementById('disconnectFlockBtn').style.display = connected ? 'inline-block' : 'none';
setFlockControlsLocked(!!connected);
setFlockExtraControls(!!connected);
}
function updateGpsStatus(connected) {
const indicator = document.getElementById('gpsStatus');
if (connected) {
indicator.classList.add('active');
} else {
indicator.classList.remove('active');
}
if (indicator) indicator.classList.toggle('active', !!connected);
document.getElementById('connectGpsBtn').style.display = connected ? 'none' : 'inline-block';
document.getElementById('disconnectGpsBtn').style.display = connected ? 'inline-block' : 'none';
setGpsControlsLocked(!!connected);
}
function loadStatus() {
@@ -1914,18 +1952,45 @@
.then(response => response.json())
.then(data => {
console.log('Status loaded:', data);
// Sniffer: reflect the actual connected port in the
// dropdown so the user can see what's connected after
// a refresh, and lock the controls.
if (data.flock_connected && data.flock_port) {
ensureSelectHasValue(
document.getElementById('flockDeviceSelect'),
data.flock_port,
data.flock_port + ' - connected'
);
}
updateFlockStatus(data.flock_connected);
updateGpsStatus(data.gps_connected);
if (data.flock_connected) {
document.getElementById('connectFlockBtn').style.display = 'none';
document.getElementById('disconnectFlockBtn').style.display = 'inline-block';
}
// GPS: source-aware restore. For serial, pin the
// connected serial port; for gpsd, populate host/port
// inputs from the reported endpoint.
if (data.gps_connected) {
document.getElementById('connectGpsBtn').style.display = 'none';
document.getElementById('disconnectGpsBtn').style.display = 'inline-block';
const source = data.gps_source || 'serial';
const srcSel = document.getElementById('gpsSourceSelect');
if (srcSel) {
srcSel.value = source;
if (typeof applyGpsSource === 'function') applyGpsSource(source);
}
if (source === 'serial' && data.gps_port) {
ensureSelectHasValue(
document.getElementById('gpsPortSelect'),
data.gps_port,
data.gps_port + ' - connected'
);
} else if (source === 'gpsd' && data.gpsd_endpoint) {
const [host, port] = String(data.gpsd_endpoint).split(':');
const hostEl = document.getElementById('gpsdHostInput');
const portEl = document.getElementById('gpsdPortInput');
if (hostEl && host) hostEl.value = host;
if (portEl && port) portEl.value = port;
}
gpsConnected = true;
}
updateGpsStatus(data.gps_connected);
})
.catch(error => {
console.error('Error loading status:', error);