fix wireless breaking routines so they work.

This commit is contained in:
Tim Young 2017-08-30 17:58:08 -05:00
parent 1cd61dd293
commit c753f0ff04
4 changed files with 25 additions and 8 deletions

View File

@ -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

View File

@ -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;
@ -2012,13 +2012,16 @@ namespace EduNetworkBuilder
didit = 2;
break;
case HowToBreak.WirelessBreakKey:
//Change the wireless key
if (tDevice.BreakWirelessKey(Data))
didit = 2;
break;
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;
}

View File

@ -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();

View File

@ -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<string> UsedNicIDStrings()
{
List<string> usedLinks = new List<string>();