Break ethernet by removing the link entirely

This commit is contained in:
Tim Young 2017-08-29 16:01:34 -05:00
parent 41ae808c39
commit 59992d0e28
3 changed files with 19 additions and 9 deletions

View File

@ -91,7 +91,7 @@ namespace EduNetworkBuilder
dump=256, pause=512}
public enum TraversalTechnology { any, none, gateway, static_route, vlan, ethernet, wireless, firewall,
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived, network_interface}
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, EthernetRemoveLink, LockOutSwitch,
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}
@ -1148,7 +1148,7 @@ namespace EduNetworkBuilder
switch(What)
{
case TraversalTechnology.ethernet:
return new List<HowToBreak>() { HowToBreak.EthernetBreak, HowToBreak.EthernetCorrupt };
return new List<HowToBreak>() { HowToBreak.EthernetBreak, HowToBreak.EthernetCorrupt, HowToBreak.EthernetRemoveLink };
case TraversalTechnology.forward:
return new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.LockOutSwitch };
case TraversalTechnology.gateway:
@ -1185,6 +1185,7 @@ namespace EduNetworkBuilder
return TraversalTechnology.network_interface;
case HowToBreak.EthernetBreak:
case HowToBreak.EthernetCorrupt:
case HowToBreak.EthernetRemoveLink:
return TraversalTechnology.ethernet;
case HowToBreak.LockOutSwitch:
return TraversalTechnology.forward; //we can only lock ourselves out of switchs and hubs

View File

@ -1963,8 +1963,19 @@ namespace EduNetworkBuilder
break;
case HowToBreak.EthernetBreak:
//break the link itself
tLink.theLinkType = LinkType.broken;
didit = 1;
if (tLink.theLinkType == LinkType.normal)
{
tLink.theLinkType = LinkType.broken;
didit = 1;
}
break;
case HowToBreak.EthernetRemoveLink:
if (tLink.theLinkType == LinkType.normal)
{
tLink.Destroy();
RemoveComponent(tLink);
didit = 1;
}
break;
case HowToBreak.EthernetCorrupt:
//Add a flourescent light

View File

@ -2170,11 +2170,9 @@ namespace EduNetworkBuilder
TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count));
List<HowToBreak> BreakList = new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.EthernetBreak,
HowToBreak.LockOutSwitch, HowToBreak.WirelessBreakKey, HowToBreak.WirelessBreakSSID, HowToBreak.VPNChangeKey,
HowToBreak.DeviceChangeIP, HowToBreak.DeviceChangeGW};
//foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
// BreakList.Add(one);
List<HowToBreak> BreakList = new List<HowToBreak>() { };
foreach (HowToBreak one in Enum.GetValues(typeof(HowToBreak)))
BreakList.Add(one);
count = 0;
int HowHard = 0;
int TraversalIndex = 0;