Tuesday, March 15, 2016

4th part of wifi password cracking "Connect with a WPA2 wifi adopter"

The 4th and one of the most important part is how to connect with the wifi using c#.
First you need to know what type of security the wifi adopter have , well my adopter have WPA2 security , so i am working with it. you can have your own securities.

Following are some kinds of securities:
WEP.
WPA.
WPA2(enterprise)
WPA2(Home)
ETC.

So Lets start.

First you need a new button and two new text box.
you can add them from tool box as i told you before.

After that. name the textbox1 to SSID_textbox and textbox2 to Password_textbox.

Now double click on the button and past this code there.

WlanClient client = new WlanClient();
            foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            {
                try
                {
                    string profilename= SSID_textbox.Text;
                    string key = Password_textbox.Text;
                    string profileXml = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><connectionMode>auto</connectionMode><autoSwitch>false</autoSwitch><MSM><security><authEncryption><authentication>WPA2PSK</authentication><encryption>AES</encryption><useOneX>false</useOneX></authEncryption><sharedKey><keyType>passPhrase</keyType><protected>false</protected><keyMaterial>{1}</keyMaterial></sharedKey></security></MSM></WLANProfile>", profilename, key);
                    wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, profileXml, true);
                    wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profilename);
                }
                catch(Exception ex)
                {
                    ex.ToString();
                }
            }
           




Now run the project and enter the SSID of Name of wifi in the SSId_textbox and its key into the Password_textbox. and click the connect button. your wifi will be connected .


Thanks for reading.
Keep visiting my bolg to see more stuff and updates.
ALLAH HAFIZ

No comments:

Post a Comment