private void Dive(string prefix, int level) { level += 1; foreach (char c in chars) { if (!running) { break; } do { System.Threading.Thread.Sleep(1); } while (paused); total++; current_wd = prefix + c; try { double mod = total % APs.Count; AccessPoint selectedAp = APs.ElementAt((int)(mod)); processOperation(selectedAp, current_wd); } catch { } if (level < maxlength) { Dive(prefix + c, level); } } }
private void processOperation(AccessPoint ap, string str) { AuthRequest authRequest = new AuthRequest(ap); authRequest.Password = str; //ap.ConnectAsync(authRequest, true, OnConnectedComplete, str); if (ap.Connect(authRequest, true)) { MessageBox.Show("Wifi Password has found: " + str); running = false; stopwatch.Stop(); } }
public AuthRequest(AccessPoint ap) { _network = ap.Network; _interface = ap.Interface; _ssidBroadcast = ap.IsSsidBroadcasted; _isPasswordRequired = _network.securityEnabled && _network.dot11DefaultCipherAlgorithm != Dot11CipherAlgorithm.None; _isEAPStore = _network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.RSNA || _network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.WPA; _isUsernameRequired = _isEAPStore; _isDomainSupported = _isEAPStore; }
public SubForm(AccessPoint ap, ref RichTextBox showRichTextBox2) { this.showRichTextBox2 = showRichTextBox2; InitializeComponent(); this.selectedAP = ap; // Создаём объект аутентификации authRequest = new AuthRequest(selectedAP); overwrite = true; textBoxUsername.Enabled = authRequest.IsUsernameRequired; textBoxPassword.Enabled = authRequest.IsPasswordRequired; textBoxDomain.Enabled = authRequest.IsDomainSupported; }
public AuthRequest(AccessPoint ap) { _network = ap.Network; _interface = ap.Interface; _isPasswordRequired = _network.securityEnabled && _network.dot11DefaultCipherAlgorithm != Dot11CipherAlgorithm.None; _isEAPStore = _network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.RSNA || _network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.WPA; _isUsernameRequired = _isEAPStore; _isDomainSupported = _isEAPStore; }
private void button2_Click(object sender, EventArgs e) { try { if (listView1.SelectedItems.Count > 0 && listView1.SelectedItems[0].Text != null) { AccessPoint AP = wifi.GetAccessPoints().Where(ap => ap.Name.Equals(listView1.SelectedItems[0].Text)).First(); AuthRequest authRequest = new AuthRequest(AP); AP.ConnectAsync(authRequest); listView1.SelectedItems[0].Selected = false; button2.Enabled = false; } } catch { } }
/// <summary> /// Return one access point that matached specified ssid Name from specified wlaninterface. /// </summary> /// <param name="wlanIface"></param> /// <param name="SsidName"></param> /// <returns></returns> public AccessPoint GetAccessPoint(WlanInterface wlanIface, string SsidName) { if (_client.NoWifiAvailable) { return(null); } if (wlanIface == null) { return(null); } WlanAvailableNetwork[] rawNetworks = wlanIface.GetAvailableNetworkList(); List <WlanAvailableNetwork> networks = new List <WlanAvailableNetwork>(); // Remove network entries without profile name if one exist with a profile name. foreach (WlanAvailableNetwork network in rawNetworks) { bool hasProfileName = !string.IsNullOrEmpty(network.profileName); bool anotherInstanceWithProfileExists = rawNetworks.Any(n => n.Equals(network) && !string.IsNullOrEmpty(n.profileName)); if (!anotherInstanceWithProfileExists || hasProfileName) { networks.Add(network); } } foreach (WlanAvailableNetwork network in networks) { if (Encoding.ASCII.GetString(network.dot11Ssid.SSID, 0, (int)network.dot11Ssid.SSIDLength) != SsidName) { continue; } AccessPoint accessPoint = new AccessPoint(wlanIface, network); return(accessPoint); } return(null); }
public void RequestPasswordConsole(AccessPoint ap, bool useVBInputBox = false) { AuthRequest authRequest = null; try { // Auth authRequest = new AuthRequest(ap); } catch (System.NullReferenceException e) { //If null, ap banished when try to connect return; } bool overwrite = true; if (authRequest.IsPasswordRequired) { if (ap.HasProfile) // If there already is a stored profile for the network, we can either use it or overwrite it with a new password. { ///For Console Console.Write("\r\nA network profile already exist, do you want to use it (y/n)? "); if (Console.ReadLine().ToLower() == "y") { overwrite = false; } } if (overwrite) { ///For Console if (authRequest.IsUsernameRequired) { if (useVBInputBox) { authRequest.Username = Microsoft.VisualBasic.Interaction.InputBox("Please Enter the UserName?", "UserName", ""); } else { Console.Write("\r\nPlease enter a username: "******"Please Enter the Password?", "Password", ""); } else { Console.Write("\r\nPlease enter the wifi password: "******"\r\nPassword is not valid for this network type."); } else { authRequest.Password = password; } } if (!authRequest.IsDomainSupported) { return; } if (useVBInputBox) { authRequest.Domain = Microsoft.VisualBasic.Interaction.InputBox("Please Enter the Domain?", "Domain", ""); } else { Console.Write("\r\nPlease enter a domain: "); authRequest.Domain = Console.ReadLine(); } } } }
public void RequestPasswordWinForm(AccessPoint ap) { AuthRequest authRequest = null; try { // Auth authRequest = new AuthRequest(ap); } catch (System.NullReferenceException e) { //If null, ap banished when try to connect return; } bool overwrite = true; if (authRequest.IsPasswordRequired) { if (ap.HasProfile) // If there already is a stored profile for the network, we can either use it or overwrite it with a new password. { ///For Windows Form if (MessageBox.Show("Do you Want Connect using network profile?", "Using Profile", MessageBoxButtons.YesNo) == DialogResult.Yes) { overwrite = false; } } if (overwrite) { ///For Windows Form if (authRequest.IsUsernameRequired) { authRequest.Username = Microsoft.VisualBasic.Interaction.InputBox("Please Enter the UserName?", "UserName", ""); } //PasswordPrompt bool validPassFormat = false; while (!validPassFormat) { string password; password = Microsoft.VisualBasic.Interaction.InputBox("Please Enter the Password?", "Password", ""); validPassFormat = ap.IsValidPassword(password); if (!validPassFormat) { if (MessageBox.Show( "Password is not valid for this network type.\n Do you want to re-enter the Password?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No) { break; } } else { authRequest.Password = password; } } if (authRequest.IsDomainSupported) { authRequest.Domain = Microsoft.VisualBasic.Interaction.InputBox("Please Enter the Domain?", "Domain", ""); } } } }
private bool ConnectToWifi(SimpleWifi.AccessPoint ap, string password) { SimpleWifi.AuthRequest authRequest = new SimpleWifi.AuthRequest(ap); authRequest.Password = wifi_passwordBox.Password; return(ap.Connect(authRequest)); }
internal JAccessPoint(WlanInterface wlanInterface, WlanAvailableNetwork network, AccessPoint thisAP) { InterfaceName = wlanInterface.InterfaceName; name = thisAP.Name; signalStrength = thisAP.SignalStrength; AuthAlgorithm = Enum.GetName(typeof(Dot11AuthAlgorithm), network.dot11DefaultAuthAlgorithm); CipherAlgorithm = Enum.GetName(typeof(Dot11CipherAlgorithm), network.dot11DefaultCipherAlgorithm); BssType = Enum.GetName(typeof(Dot11BssType), network.dot11BssType); connectable = network.networkConnectable; wlanNotConnectableReason = Enum.GetName(typeof(WlanReasonCode), network.wlanNotConnectableReason); }
static string PasswordPrompt(AccessPoint selectedAP) { string password = string.Empty; bool validPassFormat = false; while (!validPassFormat) { Console.Write("\r\nPlease enter the wifi password: "******"\r\nPassword is not valid for this network type."); } return password; }