diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index 3103823..1c7ce1e 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -58,7 +58,7 @@ namespace EduNetworkBuilder Network, Packet, NIC, Interface, Router, PacketCorruption, GeneralWireless, WirelessSSID, WirelessKey, WirelessAP, WirelessRouter, WirelessRepeater, WirelessBridge, VLAN, Power, Traceroute } - public enum CaptionType { none=0, host=1, ip=2, host_ip=3, full=4 } + public enum CaptionType { none=0, full = 1, host =2, ip=3, host_ip=4, } public enum FirewallRuleType { Allow, Drop } public enum SolvedNetworkNames { DHCP, OneNet, TwoNets, ThreeNets, firewalls, VLAN, InternetHomeAndOffice } public enum PuzzleNames diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index dfbc080..1b7618c 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1104,7 +1104,7 @@ namespace EduNetworkBuilder { BuilderWindow myWin = NB.GetBuilderWin(); if (myWin == null) return true; - Control ctl = myWin.GetControlNamed("cbViewTitles"); + Control ctl = myWin.GetControlNamed("btnCaptions"); if (ctl == null) return false; ctl.BackColor = Control.DefaultBackColor; @@ -2011,14 +2011,17 @@ namespace EduNetworkBuilder if (tDevice.BreakVPNKey(Data)) didit = 2; break; - case HowToBreak.WirelessBreakKey: - //Change the wireless key - if (tDevice.BreakWirelessKey(Data)) - didit = 2; - break; + case HowToBreak.WirelessBreakKey: case HowToBreak.WirelessBreakSSID: + //choose one of the two ends & return the device + HostNicID TheID = tLink.RandomEndpoint(); + NetworkDevice rndEnd = GetDeviceFromID(TheID); + NetworkCard tnic = rndEnd.NicFromID(TheID); //change the wireless ssid - have small list of bad keys to choose from - if (tDevice.BreakSSID(Data)) + if (How == HowToBreak.WirelessBreakSSID && rndEnd.BreakSSID(tnic.NicName())) + didit = 2; + //Change the wireless key + if (How == HowToBreak.WirelessBreakKey && rndEnd.BreakWirelessKey(tnic.NicName())) didit = 2; break; } diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 0d08955..5eeba47 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2222,6 +2222,10 @@ namespace EduNetworkBuilder myNetwork.OptionShowLabels = CaptionType.host; myNetwork.ShowLabelsHere = CaptionType.host; + //If we broke the wireless, show as disconnected. + myNetwork.DoAllVerifyLinks(); + myNetwork.DoAllAutoJoin(); + myNetwork.ClearMessages(); myNetwork.DoAllClearDHCP(); diff --git a/EduNetworkBuilder/NetworkLink.cs b/EduNetworkBuilder/NetworkLink.cs index b83e6b6..55f41d1 100644 --- a/EduNetworkBuilder/NetworkLink.cs +++ b/EduNetworkBuilder/NetworkLink.cs @@ -301,6 +301,16 @@ namespace EduNetworkBuilder return answer; } + public HostNicID RandomEndpoint() + { + Random rnd = NB.GetRandom(); + HostNicID theID; + if (rnd.Next(2) == 0) theID = SrcNic; + else theID = DstNic; + + return theID; + } + public List UsedNicIDStrings() { List usedLinks = new List();