fragattack: updated event handling to support more devices

This commit is contained in:
Mathy Vanhoef 2020-06-26 15:50:18 +04:00 committed by Mathy Vanhoef
parent f73b151698
commit c6e8086d10
4 changed files with 19 additions and 18 deletions

View File

@ -928,7 +928,7 @@ class Authenticator(Daemon):
def handle_wpaspy(self, msg):
log(DEBUG, "daemon: " + msg)
if "AP-STA-CONNECTING" in msg:
if "AP-STA-NEW" in msg:
cmd, clientmac = msg.split()
self.add_station(clientmac)
@ -1111,29 +1111,26 @@ class Supplicant(Daemon):
def handle_wpaspy(self, msg):
log(DEBUG, "daemon: " + msg)
if "WPA: Key negotiation completed with" in msg:
# This get's the current keys
self.station.handle_authenticated()
elif "Trying to authenticate with" in msg:
if "Associated with" in msg:
# When using a separate interface to inject, switch to correct channel
self.follow_channel()
p = re.compile("Trying to authenticate with (.*) \(SSID")
bss = p.search(msg).group(1)
self.station.handle_connecting(bss)
elif "Trying to associate with" in msg:
# With the ath9k_htc, injection in mixed managed/monitor only works after
# sending the association request. So only perform injection test now.
self.injection_test(self.station.bss)
p = re.compile("Associated with (.*) successfully")
bss = p.search(msg).group(1)
self.station.handle_connecting(bss)
elif "EAPOL-TX" in msg:
cmd, srcaddr, payload = msg.split()
self.station.handle_eapol_tx(bytes.fromhex(payload))
# This event only occurs with WEP
elif "WPA: EAPOL processing complete" in msg:
# The "EAPOL processing" event only occurs with WEP
if "WPA: Key negotiation completed with" in msg or \
"WPA: EAPOL processing complete" in msg:
# This get's the current keys
self.station.handle_authenticated()
def roam(self, station):

View File

@ -2613,11 +2613,6 @@ static void handle_auth(struct hostapd_data *hapd,
#endif /* CONFIG_FILS */
}
#ifdef CONFIG_TESTING_OPTIONS
wpa_msg(hapd->msg_ctx, MSG_INFO, "AP-STA-CONNECTING " MACSTR,
MAC2STR(sta->addr));
#endif /* CONFIG_TESTING_OPTIONS */
fail:
reply_res = send_auth_reply(hapd, sta, mgmt->sa, mgmt->bssid, auth_alg,
auth_transaction + 1, resp, resp_ies,

View File

@ -725,6 +725,11 @@ struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
sta->last_seq_ctrl = WLAN_INVALID_MGMT_SEQ;
dl_list_init(&sta->ip6addr);
#ifdef CONFIG_TESTING_OPTIONS
wpa_msg(hapd->msg_ctx, MSG_INFO, "AP-STA-NEW " MACSTR,
MAC2STR(sta->addr));
#endif /* CONFIG_TESTING_OPTIONS */
#ifdef CONFIG_TAXONOMY
sta_track_claim_taxonomy_info(hapd->iface, addr,
&sta->probe_ie_taxonomy);

View File

@ -2959,6 +2959,10 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
wpa_s->sme.last_unprot_disconnect.sec = 0;
#endif /* CONFIG_SME */
#ifdef CONFIG_TESTING_OPTIONS
wpa_msg_ctrl(wpa_s, MSG_INFO, "Associated with " MACSTR
" successfully", MAC2STR(bssid));
#endif /* CONFIG_TESTING_OPTIONS */
wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));
if (wpa_s->current_ssid) {
/* When using scanning (ap_scan=1), SIM PC/SC interface can be