forge
Explore
Log in

Don't you dare go Hollow

StartScan: optional static channel list for parked diagnostics

Browse files at this commit

fdf5c5a4f2fd413e3df2e1b744b4bfc718af4929Ahmet Kaan GümüşParent: 5d9149d
src/common.rsmodified+8 -1
@@ -222,7 +222,13 @@ pub enum Cmd {
222 /// Switch `ifname` to monitor mode and start the channel-hopping222 /// Switch `ifname` to monitor mode and start the channel-hopping
223 /// scanner. `ifname` is saved as the interface to restore on223 /// scanner. `ifname` is saved as the interface to restore on
224 /// StopScan/Shutdown.224 /// StopScan/Shutdown.
225- StartScan { ifname: String },225+ StartScan {
226+ ifname: String,
227+ /// Optional static channel list (diagnostics: park on one channel
228+ /// instead of hopping). `None`/empty = full hop list.
229+ #[serde(default)]
230+ channels: Option<Vec<u8>>,
231+ },
226 /// Stop the scanner, restore managed mode.232 /// Stop the scanner, restore managed mode.
227 StopScan,233 StopScan,
228 /// Blast `count` deauth rounds at `target` (broadcast allowed) from234 /// Blast `count` deauth rounds at `target` (broadcast allowed) from
@@ -378,6 +384,7 @@ mod tests {
378 let cases: Vec<Cmd> = vec![384 let cases: Vec<Cmd> = vec![
379 Cmd::StartScan {385 Cmd::StartScan {
380 ifname: "wlp14s0".into(),386 ifname: "wlp14s0".into(),
387+ channels: None,
381 },388 },
382 Cmd::StopScan,389 Cmd::StopScan,
383 Cmd::Deauth {390 Cmd::Deauth {
src/service.rsmodified+6 -3
@@ -98,7 +98,7 @@ impl RadioService {
98 /// [`Event::Error`] is emitted, the interface is put back into managed98 /// [`Event::Error`] is emitted, the interface is put back into managed
99 /// mode (best effort). A previous scan session must be stopped first99 /// mode (best effort). A previous scan session must be stopped first
100 /// (or have failed); the stop flag is always fresh here.100 /// (or have failed); the stop flag is always fresh here.
101- fn start_scan(&mut self, ifname: &str) {101+ fn start_scan(&mut self, ifname: &str, channels: &[u8]) {
102 self.stop = Arc::new(AtomicBool::new(false));102 self.stop = Arc::new(AtomicBool::new(false));
103 self.mon_ifname = None;103 self.mon_ifname = None;
104 self.orig_ifname = Some(ifname.to_string());104 self.orig_ifname = Some(ifname.to_string());
@@ -118,7 +118,7 @@ impl RadioService {
118 118
119 let cfg = scanner::ScannerConfig {119 let cfg = scanner::ScannerConfig {
120 ifname: mon_ifname,120 ifname: mon_ifname,
121- channels: Vec::new(), // empty = full hop list121+ channels: channels.to_vec(), // empty = full hop list
122 dwell_ms: 100,122 dwell_ms: 100,
123 rssi_floor: -95,123 rssi_floor: -95,
124 };124 };
@@ -355,7 +355,9 @@ fn service_main() -> i32 {
355 }355 }
356 };356 };
357 match cmd {357 match cmd {
358- Cmd::StartScan { ifname } => radio.start_scan(&ifname),358+ Cmd::StartScan { ifname, channels } => {
359+ radio.start_scan(&ifname, channels.as_deref().unwrap_or(&[]))
360+ }
359 Cmd::StopScan => radio.stop_scan(),361 Cmd::StopScan => radio.stop_scan(),
360 Cmd::Deauth {362 Cmd::Deauth {
361 ap,363 ap,
@@ -536,6 +538,7 @@ impl ServiceClient {
536 };538 };
537 client.cmd(&Cmd::StartScan {539 client.cmd(&Cmd::StartScan {
538 ifname: ifname.to_string(),540 ifname: ifname.to_string(),
541+ channels: None,
539 });542 });
540 Ok(client)543 Ok(client)
541 }544 }
src/ui/app.rsmodified+1 -0
@@ -261,6 +261,7 @@ impl AppRoot {
261 // for a fresh scan session.261 // for a fresh scan session.
262 svc.cmd(&Cmd::StartScan {262 svc.cmd(&Cmd::StartScan {
263 ifname: ifname.clone(),263 ifname: ifname.clone(),
264+ channels: None,
264 });265 });
265 self.state.iface_running = true;266 self.state.iface_running = true;
266 self.state267 self.state