I plan to create an application that checks if a particular Wi-Fi network uses a shared password. I have a list of the most common passwords, but the following function:
public boolean connectTo(String psKey){ WifiConfiguration wc = new WifiConfiguration(); wc.SSID = "\"" + dbw.getSsid() + "\""; wc.preSharedKey = "\"" + psKey + "\""; wc.status = WifiConfiguration.Status.ENABLED; wc = configureCapabs(wc, dbw.getCapability()); int res = wifi.addNetwork(wc); Toast.makeText(this, "add Network returned " + res , Toast.LENGTH_SHORT).show(); boolean b = wifi.enableNetwork(res, true); Toast.makeText(this, "enableNetwork returned " + b , Toast.LENGTH_SHORT).show(); if(!b) return false; boolean fin = wifi.reconnect(); return fin; }
it returns true even if the password was incorrect. Is there a way to check if the password I was trying to login with was accepted or rejected?
source share