forge
Explore
Log in

Don't you dare go Hollow

explicit privilege + NM warnings; in-UI Stop NM button; docs

Browse files at this commit

795bcd1ab83a46b7ec608f0c1844a16bee7e4e36Ahmet Kaan GümüşParent: 35195ec
docs/USAGE.mdmodified+8 -7
@@ -28,13 +28,14 @@ just logs a reminder; nothing fails mid-attack.
28 Not root? The badge shows it and a toast warns once — the UI stays28 Not root? The badge shows it and a toast warns once — the UI stays
29 usable, but every attack will fail with errors in the Log page.29 usable, but every attack will fail with errors in the Log page.
30 30
31-The tool does **not** kill or stop anything on your system. If31+**NetworkManager fight:** while NetworkManager is active it pins the card
32-NetworkManager/wpa_supplicant grab the interface (channel changes fail,32+to the connected network's channel — during a scan you will typically see
33-no packets), stop them yourself, e.g.:33+**only that one SSID** (e.g. your connected network) instead of every
34-34+neighbour. The app detects this at *Start capture*, shows a destructive
35-```sh35+toast, logs a warning, and offers a **"Stop NM"** button in the header
36-sudo systemctl stop NetworkManager # optional, only if attacks misbehave36+(one click, uses the elevated session). Restore it afterwards with
37-```37+`systemctl start NetworkManager`. Everything else on the system is left
38+untouched.
38 39
39 ## Workflow40 ## Workflow
40 41
src/iface.rsmodified+21 -0
@@ -170,6 +170,27 @@ pub fn is_root() -> bool {
170 (unsafe { libc::geteuid() }) == 0170 (unsafe { libc::geteuid() }) == 0
171 }171 }
172 172
173+/// True while NetworkManager is active — it will fight channel control and
174+/// pin the card to the connected network's channel (only *that* SSID's
175+/// beacons get seen). No root needed to check.
176+pub fn networkmanager_active() -> bool {
177+ Command::new("systemctl")
178+ .args(["is-active", "--quiet", "NetworkManager"])
179+ .status()
180+ .map(|s| s.success())
181+ .unwrap_or(false)
182+}
183+
184+/// Stop NetworkManager (and with it wpa_supplicant's radio fighting).
185+/// Requires root. Restart later with `systemctl start NetworkManager`.
186+pub fn stop_networkmanager() -> Result<()> {
187+ run(
188+ "systemctl",
189+ &["stop".into(), "NetworkManager".into()],
190+ )
191+ .map(|_| ())
192+}
193+
173 /// True when `pkexec` (polkit) is available for GUI privilege elevation.194 /// True when `pkexec` (polkit) is available for GUI privilege elevation.
174 pub fn pkexec_available() -> bool {195 pub fn pkexec_available() -> bool {
175 Command::new("pkexec")196 Command::new("pkexec")
src/ui/app.rsmodified+54 -1
@@ -85,6 +85,8 @@ pub struct AppRoot {
85 /// flight. 0 = waiting on the polkit dialog, 1 = elevated instance85 /// flight. 0 = waiting on the polkit dialog, 1 = elevated instance
86 /// launched (quit this one), 2 = declined/failed (message was logged).86 /// launched (quit this one), 2 = declined/failed (message was logged).
87 pub elevation: Option<Arc<AtomicU8>>,87 pub elevation: Option<Arc<AtomicU8>>,
88+ /// NetworkManager seen active when capture started (fights channels).
89+ pub nm_active: bool,
88 /// Used to invalidate stale cracker simulation ticks after Stop/re-Start.90 /// Used to invalidate stale cracker simulation ticks after Stop/re-Start.
89 pub crack_epoch: u64,91 pub crack_epoch: u64,
90 pub ap_sort: Option<SortDescriptor>,92 pub ap_sort: Option<SortDescriptor>,
@@ -158,6 +160,7 @@ impl AppRoot {
158 crack_inflight: false,160 crack_inflight: false,
159 pending_toast: None,161 pending_toast: None,
160 elevation: None,162 elevation: None,
163+ nm_active: false,
161 crack_epoch: 0,164 crack_epoch: 0,
162 ap_sort: None,165 ap_sort: None,
163 client_sort: None,166 client_sort: None,
@@ -247,11 +250,27 @@ impl AppRoot {
247 } else {250 } else {
248 if !self.is_root {251 if !self.is_root {
249 self.state.push_log(252 self.state.push_log(
250- "ui: capture needs root — click \"Elevate via polkit\" in the header first".to_string(),253+ "ui: capture REFUSED — no root privileges. Elevate via polkit first.".to_string(),
254+ );
255+ self.pending_toast = Some(
256+ "ELEVATION REQUIRED: click \"Elevate via polkit\" in the header before starting capture".into(),
251 );257 );
252 cx.notify();258 cx.notify();
253 return;259 return;
254 }260 }
261+ // NetworkManager fight: pin-to-connected-channel makes ONLY the
262+ // associated network (e.g. parafin) visible during the hop.
263+ if crate::iface::networkmanager_active() {
264+ self.nm_active = true;
265+ self.state.push_log(
266+ "ui: WARNING NetworkManager is active — it pins the card to the connected \
267+ network's channel; you will likely see ONLY that SSID. Use \"Stop NM\" in the header."
268+ .to_string(),
269+ );
270+ self.pending_toast = Some(
271+ "NetworkManager is active — only your connected network may be visible; stop it from the header".into(),
272+ );
273+ }
255 let ifname = self.state.ifname.clone();274 let ifname = self.state.ifname.clone();
256 match Backend::start_scan(&ifname, self.tx.clone()) {275 match Backend::start_scan(&ifname, self.tx.clone()) {
257 Ok(be) => {276 Ok(be) => {
@@ -269,6 +288,27 @@ impl AppRoot {
269 }288 }
270 }289 }
271 290
291+ /// Stop NetworkManager (root) so it stops pinning the radio to the
292+ /// connected network's channel.
293+ pub fn stop_nm(&mut self, cx: &mut Context<Self>) {
294+ match crate::iface::stop_networkmanager() {
295+ Ok(()) => {
296+ self.nm_active = false;
297+ self.state.push_log(
298+ "ui: NetworkManager stopped — channel hopping is now exclusive; restart it later with `systemctl start NetworkManager`"
299+ .to_string(),
300+ );
301+ self.pending_toast =
302+ Some("NetworkManager stopped — all networks become visible as the hopper cycles".into());
303+ }
304+ Err(e) => {
305+ self.state
306+ .push_log(format!("ERROR stopping NetworkManager: {e:#}"));
307+ }
308+ }
309+ cx.notify();
310+ }
311+
272 /// Re-exec this app as root via polkit (pkexec). The polkit dialog is312 /// Re-exec this app as root via polkit (pkexec). The polkit dialog is
273 /// fully OS-driven; on success the elevated instance opens its own313 /// fully OS-driven; on success the elevated instance opens its own
274 /// window and this one closes itself.314 /// window and this one closes itself.
@@ -487,6 +527,17 @@ impl AppRoot {
487 }527 }
488 });528 });
489 529
530+ let nm_badge = (self.nm_active && !self.is_mock)
531+ .then(|| badge("NM active — channels pinned").destructive());
532+ let nm_btn = (self.nm_active && self.is_root && !self.is_mock).then(|| {
533+ button("stop-nm", "Stop NM").on_click({
534+ let view = view.clone();
535+ move |_, _window, cx| {
536+ view.update(cx, |app, cx| app.stop_nm(cx));
537+ }
538+ })
539+ });
540+
490 h_stack()541 h_stack()
491 .w_full()542 .w_full()
492 .px_4()543 .px_4()
@@ -500,6 +551,8 @@ impl AppRoot {
500 .child(privilege)551 .child(privilege)
501 .children(elevate_btn)552 .children(elevate_btn)
502 .child(div().w(px(220.)).child(self.iface_select.clone()))553 .child(div().w(px(220.)).child(self.iface_select.clone()))
554+ .children(nm_badge)
555+ .children(nm_btn)
503 .child(toggle)556 .child(toggle)
504 .child(div().flex_1())557 .child(div().flex_1())
505 .child(558 .child(