Exemple #1
0
		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;
		}
Exemple #2
0
		internal AccessPoint(WlanInterface interfac, WlanAvailableNetwork network)
		{
			_interface = interfac;
			_network = network;
		}
Exemple #3
0
		public bool Equals(WlanAvailableNetwork network)
		{
			// Compares the two SSID byte arrays
			return this.dot11Ssid.SSIDLength == network.dot11Ssid.SSIDLength 
				&& this.dot11Ssid.SSID.SequenceEqual(network.dot11Ssid.SSID);
		}
Exemple #4
0
 public bool Equals(WlanAvailableNetwork network)
 {
     // Compares the two SSID byte arrays
     return(this.dot11Ssid.SSIDLength == network.dot11Ssid.SSIDLength &&
            this.dot11Ssid.SSID.SequenceEqual(network.dot11Ssid.SSID));
 }
Exemple #5
0
		/// <summary>
		/// Converts a pointer to a available networks list (header + entries) to an array of available network entries.
		/// </summary>
		/// <param name="bssListPtr">A pointer to an available networks list's header.</param>
		/// <returns>An array of available network entries.</returns>
		private WlanAvailableNetwork[] ConvertAvailableNetworkListPtr(IntPtr availNetListPtr)
		{
			WlanAvailableNetworkListHeader availNetListHeader = (WlanAvailableNetworkListHeader)Marshal.PtrToStructure(availNetListPtr, typeof(WlanAvailableNetworkListHeader));
			long availNetListIt = availNetListPtr.ToInt64() + Marshal.SizeOf(typeof(WlanAvailableNetworkListHeader));			
			WlanAvailableNetwork[] availNets = new WlanAvailableNetwork[availNetListHeader.numberOfItems];			
			for (int i = 0; i < availNetListHeader.numberOfItems; ++i)
			{
				availNets[i] = (WlanAvailableNetwork)Marshal.PtrToStructure(new IntPtr(availNetListIt), typeof(WlanAvailableNetwork));
				availNetListIt += Marshal.SizeOf(typeof(WlanAvailableNetwork));
			}

			return availNets;
		}
Exemple #6
-1
		/// <summary>
		/// Generates the profile XML for the access point and password
		/// </summary>
		internal static string Generate(WlanAvailableNetwork network, string password)
		{
			string profile	= string.Empty;
			string template = string.Empty;
			string name		= Encoding.ASCII.GetString(network.dot11Ssid.SSID, 0, (int)network.dot11Ssid.SSIDLength);
			string hex		= GetHexString(network.dot11Ssid.SSID);	

			var authAlgo = network.dot11DefaultAuthAlgorithm;

			switch (network.dot11DefaultCipherAlgorithm)
			{
				case Dot11CipherAlgorithm.None:
					template = GetTemplate("OPEN");					
					profile = string.Format(template, name, hex);
					break;
				case Dot11CipherAlgorithm.WEP:
					template = GetTemplate("WEP");					
					profile = string.Format(template, name, hex, password);
					break;
				case Dot11CipherAlgorithm.CCMP:
					if (authAlgo == Dot11AuthAlgorithm.RSNA)
					{
						template = GetTemplate("WPA2-Enterprise-PEAP-MSCHAPv2");
						profile = string.Format(template, name);
					}
					else // PSK
					{
						template = GetTemplate("WPA2-PSK");
						profile = string.Format(template, name, password);
					}
					break;
				case Dot11CipherAlgorithm.TKIP:
					#warning Robin: Not sure WPA uses RSNA
					if (authAlgo == Dot11AuthAlgorithm.RSNA)
					{
						template = GetTemplate("WPA-Enterprise-PEAP-MSCHAPv2");
						profile = string.Format(template, name);
					}
					else // PSK
					{
						template = GetTemplate("WPA-PSK");
						profile = string.Format(template, name, password);
					}

					break;			
				default:
					throw new NotImplementedException("Profile for selected cipher algorithm is not implemented");
			}					

			return profile;
		}