Android gets the current hidden and hidden WiFi encryption Method (security)

Source: Internet
Author: User

1. There are several ways of general WiFi encryption:(1). WPA-PSK/WPA2-PSK (Currently the safest home encryption)
(2). WPA/WPA2 (Less secure)
(3). WEP (poor security)

2. General Click System the current network will have pop-up details
So thisSecurityHow did you get it? By looking at the system source code know:
public class Mainactivity extends Activity {@Override protected void onCreate (Bundle savedinstancestate) {s        Uper.oncreate (savedinstancestate);        Setcontentview (R.layout.activity_main);        Wifimanager Mwifimanager = (wifimanager) getsystemservice (Context.wifi_service);        Wifiinfo info = Mwifimanager.getconnectioninfo ();        Get the configured network connection list<wificonfiguration> wificonfiglist = Mwifimanager.getconfigurednetworks ();            for (int i = 0; i < wificonfiglist.size (); i++) {log.i ("Hefeng", Wificonfiglist.get (i). toString ()); LOG.I ("Hefeng", Info.getssid () + "| |" + wificonfiglist.get (i).            SSID); if (Info.getssid (). Equals (Wificonfiglist.get (i).            SSID) {log.e ("Hefeng", "Current network security:" + getsecurity (Wificonfiglist.get (i))); }}}/** * These values is matched in string arrays--changes must is kept in sync */static fi    nal int security_none = 0; static final int SecuritY_WEP = 1;    static final int SECURITY_PSK = 2;    static final int security_eap = 3;            static int getsecurity (wificonfiguration config) {if (Config.allowedKeyManagement.get (KEYMGMT.WPA_PSK)) {        return SECURITY_PSK;            } if (Config.allowedKeyManagement.get (keymgmt.wpa_eap) | | config.allowedKeyManagement.get (keymgmt.ieee8021x)) {        return security_eap; } return (config.wepkeys[0]! = null)?    Security_wep:security_none; }

So you can get it. Doing so will prevent your wifi SSID from being hidden and can also get to encryption Mode 3. General access to encryption is the case, but once you set the SSID on the router to hide, you will not be able to search
public void Getciphertype (context context, String SSID) {        Wifimanager Wifimanager = (Wifimanager) Context.getsystemservice (context.wifi_service);        list<scanresult> list = Wifimanager.getscanresults ();        for (Scanresult scresult:list) {            if (! Textutils.isempty (SCRESULT.SSID) && scResult.SSID.equals (SSID)) {                String capabilities = scresult.capabilities;                LOG.I ("Hefeng", "capabilities=" + capabilities);                if (! Textutils.isempty (capabilities)) {                    if (Capabilities.contains ("WPA") | | capabilities.contains ("WPA")) {                        LOG.I ("Hefeng", "WPA");                    else if (Capabilities.contains ("WEP") | | capabilities.contains ("WEP")) {                        log.i ("Hefeng", "WEP");                    } else {                        log.i ("Hefeng", "No");}}}}    



Android gets the current hidden and hidden WiFi encryption Method (security)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.