mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
wpadebug: Add broadcast intent receiver for Wi-Fi events
This makes it easier to debug Android framework actions with all the related broadcast intents being logged. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e679f140b9
commit
53aafe75e0
@ -53,5 +53,15 @@
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<receiver android:name="w1.fi.wpadebug.WifiReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.wifi.STATE_CHANGE" />
|
||||
<action android:name="android.net.wifi.RSSI_CHANGED" />
|
||||
<action android:name="android.net.wifi.SCAN_RESULTS" />
|
||||
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
|
||||
<action android:name="android.net.wifi.supplicant.STATE_CHANGE" />
|
||||
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
95
wpadebug/src/w1/fi/wpadebug/WifiReceiver.java
Normal file
95
wpadebug/src/w1/fi/wpadebug/WifiReceiver.java
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* wpadebug - wpa_supplicant and Wi-Fi debugging app for Android
|
||||
* Copyright (c) 2013, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
package w1.fi.wpadebug;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class WifiReceiver extends BroadcastReceiver
|
||||
{
|
||||
private static final String TAG = "wpadebug";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context c, Intent intent)
|
||||
{
|
||||
String act = intent.getAction();
|
||||
Log.d(TAG, "Received broadcast intent: action=" + act);
|
||||
|
||||
Bundle bundles = intent.getExtras();
|
||||
if (bundles == null)
|
||||
return;
|
||||
|
||||
if (bundles.containsKey("bssid")) {
|
||||
String val;
|
||||
val = intent.getStringExtra("bssid");
|
||||
if (val != null)
|
||||
Log.d(TAG, " bssid: " + val);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("networkInfo")) {
|
||||
NetworkInfo info;
|
||||
info = (NetworkInfo) intent.getParcelableExtra("networkInfo");
|
||||
if (info != null)
|
||||
Log.d(TAG, " networkInfo: " + info);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("newRssi")) {
|
||||
int val;
|
||||
val = intent.getIntExtra("newRssi", -1);
|
||||
Log.d(TAG, " newRssi: " + val);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("newState")) {
|
||||
SupplicantState state;
|
||||
state = (SupplicantState) intent.getParcelableExtra("newState");
|
||||
if (state != null)
|
||||
Log.d(TAG, " newState: " + state);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("previous_wifi_state")) {
|
||||
int wifi_state;
|
||||
wifi_state = intent.getIntExtra("previous_wifi_state", -1);
|
||||
if (wifi_state != -1)
|
||||
Log.d(TAG, " previous_wifi_state: " + wifi_state);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("connected")) {
|
||||
boolean connected;
|
||||
connected = intent.getBooleanExtra("connected", false);
|
||||
Log.d(TAG, " connected: " + connected);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("supplicantError")) {
|
||||
int error;
|
||||
error = intent.getIntExtra("supplicantError", -1);
|
||||
if (error != -1)
|
||||
Log.d(TAG, " supplicantError: " + error);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("wifiInfo")) {
|
||||
WifiInfo info;
|
||||
info = (WifiInfo) intent.getParcelableExtra("wifiInfo");
|
||||
if (info != null)
|
||||
Log.d(TAG, " wifiInfo: " + info);
|
||||
}
|
||||
|
||||
if (bundles.containsKey("wifi_state")) {
|
||||
int wifi_state;
|
||||
wifi_state = intent.getIntExtra("wifi_state", -1);
|
||||
if (wifi_state != -1)
|
||||
Log.d(TAG, " wifi_state: " + wifi_state);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user