diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 2160f3f..83ce59e 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1933,7 +1933,7 @@ namespace EduNetworkBuilder } } - int BreakNetComponent(NetworkComponent What, HowToBreak How) + int BreakNetComponent(NetworkComponent What, HowToBreak How, string Data) { int didit = 0; NetworkDevice tDevice = null; @@ -1964,6 +1964,7 @@ namespace EduNetworkBuilder case HowToBreak.LockOutSwitch: //Lock it out if (tDevice.DoesForwarding()) tDevice.LockUsOutOfDevice(); + didit = 1; break; case HowToBreak.StaticRouteClear: //Clear out the static route(s) @@ -1979,12 +1980,18 @@ namespace EduNetworkBuilder break; case HowToBreak.VPNChangeKey: //change the key for the VPN encryption + if (tDevice.BreakVPNKey(Data)) + didit = 2; break; case HowToBreak.WirelessBreakKey: //Change the wireless key + if (tDevice.BreakWirelessKey(Data)) + didit = 2; break; case HowToBreak.WirelessBreakSSID: //change the wireless ssid - have small list of bad keys to choose from + if (tDevice.BreakSSID(Data)) + didit = 2; break; } return didit; @@ -2014,13 +2021,14 @@ namespace EduNetworkBuilder while(count < 3) { string host = ThePath.HostnameFromTechnology(WhatNeeded); - if(host != "") + if (host != "") { + string data = ThePath.DataFromTechnologyAndHost(WhatNeeded, host); //We have a host, see if we can break it. NetworkComponent NC = ComponentFromName(host); if(NC != null) { - int answer = BreakNetComponent(NC, How); + int answer = BreakNetComponent(NC, How, data); if (answer > 0) { if(!AlreadyHasPingTest(ThePath.Source(), ThePath.Destination())) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 4afdfd0..e326306 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -2170,7 +2170,8 @@ namespace EduNetworkBuilder TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count)); - List BreakList = new List() { HowToBreak.PowerOff, HowToBreak.EthernetBreak, HowToBreak.LockOutSwitch }; + List BreakList = new List() { HowToBreak.PowerOff, HowToBreak.EthernetBreak, + HowToBreak.LockOutSwitch, HowToBreak.WirelessBreakKey, HowToBreak.WirelessBreakSSID, HowToBreak.VPNChangeKey }; //foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak))) // BreakList.Add(one); count = 0; diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 60981df..64f6cac 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -3090,6 +3090,27 @@ namespace EduNetworkBuilder return true; } + public bool BreakVPNKey(string nicname) + { + //find the nic. + NetworkCard nic = NicFromName(nicname); + if (nic == null) return false; //we could not do it. + + List choices = new List() { "Key", "Llave","ChangeMe", + "Password","key","default","admin",}; + choices.Add(nic.EncryptionKey.ToUpper()); + choices.Add(nic.EncryptionKey.ToLower()); + if (nic.EncryptionKey.Length > 4) + choices.Add(nic.EncryptionKey.Substring(0, 2) + nic.EncryptionKey.Substring(2, 1).ToUpper() + nic.EncryptionKey.Substring(3)); + + choices = NB.Randomize(choices); + string choice = choices[0]; //grab the first one + + if (nic.WirelessKey == choice) return false; + nic.WirelessKey = choice; //change it + return true; + } + #endregion - } + } } diff --git a/EduNetworkBuilder/TraversalClass.cs b/EduNetworkBuilder/TraversalClass.cs index f08e435..b694412 100644 --- a/EduNetworkBuilder/TraversalClass.cs +++ b/EduNetworkBuilder/TraversalClass.cs @@ -99,5 +99,24 @@ namespace EduNetworkBuilder } return ""; } + + public string DataFromTechnologyAndHost(TraversalTechnology What, string hostname) + { + //make a randomized copy of the list, and return the first item that has the technology + List tPathTaken = NB.Randomize(PathTaken); + if (What != TraversalTechnology.any) + { + foreach (TraversalRecord one in tPathTaken) + { + if (one.WhatUsed == What && hostname == one.host) return one.AdditionalData; + } + } + else + { + //We do not have any AdditionalData for a type of "any" + return ""; + } + return ""; + } } }