more functions preparing to break a network
This commit is contained in:
parent
7a15bbd1ce
commit
75bcd6d0ba
@ -89,7 +89,7 @@ namespace EduNetworkBuilder
|
|||||||
public enum DebugPausePoint { none=0, packet_create=1, packet_kill=2,
|
public enum DebugPausePoint { none=0, packet_create=1, packet_kill=2,
|
||||||
packet_in=4, packet_out=8, packet_duplicate=16, all=63,
|
packet_in=4, packet_out=8, packet_duplicate=16, all=63,
|
||||||
dump=256, pause=512}
|
dump=256, pause=512}
|
||||||
public enum TraversalTechnology { gateway, static_route, vlan, ethernet, wireless, firewall,
|
public enum TraversalTechnology { any, none, gateway, static_route, vlan, ethernet, wireless, firewall,
|
||||||
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived}
|
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived}
|
||||||
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
|
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
|
||||||
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
|
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
|
||||||
@ -1137,5 +1137,73 @@ namespace EduNetworkBuilder
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// return a list of ways to break a given technology
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="What"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<HowToBreak> WaysToBreakATechnology(TraversalTechnology What)
|
||||||
|
{
|
||||||
|
switch(What)
|
||||||
|
{
|
||||||
|
case TraversalTechnology.ethernet:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.EthernetBreak, HowToBreak.EthernetCorrupt };
|
||||||
|
case TraversalTechnology.forward:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.PowerOff, HowToBreak.LockOutSwitch };
|
||||||
|
case TraversalTechnology.gateway:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.DeviceChangeGW };
|
||||||
|
case TraversalTechnology.firewall:
|
||||||
|
return new List<HowToBreak>() { };
|
||||||
|
case TraversalTechnology.ip_address:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.DeviceChangeIP };
|
||||||
|
case TraversalTechnology.masquerade:
|
||||||
|
return new List<HowToBreak>() { };
|
||||||
|
case TraversalTechnology.static_route:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.StaticRouteClear, HowToBreak.StaticRouteCorrupt };
|
||||||
|
case TraversalTechnology.vlan:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.VLANChange};
|
||||||
|
case TraversalTechnology.vpn:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.VPNChangeEndpoint, HowToBreak.VPNChangeKey };
|
||||||
|
case TraversalTechnology.vpn_decryption:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.VPNChangeKey };
|
||||||
|
case TraversalTechnology.vpn_encryption:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.VPNChangeKey };
|
||||||
|
case TraversalTechnology.wireless:
|
||||||
|
return new List<HowToBreak>() { HowToBreak.WirelessBreakKey, HowToBreak.WirelessBreakSSID };
|
||||||
|
}
|
||||||
|
return new List<HowToBreak>(); //An empty list
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TraversalTechnology TechnologyNeededToBreak(HowToBreak How)
|
||||||
|
{
|
||||||
|
switch(How)
|
||||||
|
{
|
||||||
|
case HowToBreak.DeviceChangeGW:
|
||||||
|
return TraversalTechnology.gateway;
|
||||||
|
case HowToBreak.DeviceChangeIP:
|
||||||
|
return TraversalTechnology.ip_address;
|
||||||
|
case HowToBreak.EthernetBreak:
|
||||||
|
case HowToBreak.EthernetCorrupt:
|
||||||
|
return TraversalTechnology.ethernet;
|
||||||
|
case HowToBreak.LockOutSwitch:
|
||||||
|
return TraversalTechnology.forward; //we can only lock ourselves out of switchs and hubs
|
||||||
|
case HowToBreak.PowerOff:
|
||||||
|
return TraversalTechnology.any; //Any will only return devices
|
||||||
|
case HowToBreak.StaticRouteClear:
|
||||||
|
case HowToBreak.StaticRouteCorrupt:
|
||||||
|
return TraversalTechnology.static_route;
|
||||||
|
case HowToBreak.VLANChange:
|
||||||
|
return TraversalTechnology.vlan;
|
||||||
|
case HowToBreak.VPNChangeEndpoint:
|
||||||
|
return TraversalTechnology.vpn;
|
||||||
|
case HowToBreak.VPNChangeKey:
|
||||||
|
return TraversalTechnology.vpn;
|
||||||
|
case HowToBreak.WirelessBreakKey:
|
||||||
|
case HowToBreak.WirelessBreakSSID:
|
||||||
|
return TraversalTechnology.wireless;
|
||||||
|
}
|
||||||
|
return TraversalTechnology.none;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1908,6 +1908,62 @@ namespace EduNetworkBuilder
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BreakNetComponent(NetworkComponent What, HowToBreak How)
|
||||||
|
{
|
||||||
|
bool didit = false;
|
||||||
|
NetworkDevice tDevice = null;
|
||||||
|
NetworkLink tLink = null;
|
||||||
|
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
||||||
|
if (What is NetworkLink) tLink = (NetworkLink)What;
|
||||||
|
switch(How)
|
||||||
|
{
|
||||||
|
case HowToBreak.PowerOff:
|
||||||
|
tDevice.PowerOff = true;
|
||||||
|
didit = true;
|
||||||
|
break;
|
||||||
|
case HowToBreak.DeviceChangeGW:
|
||||||
|
break;
|
||||||
|
case HowToBreak.DeviceChangeIP:
|
||||||
|
break;
|
||||||
|
case HowToBreak.EthernetBreak:
|
||||||
|
tLink.theLinkType = LinkType.broken;
|
||||||
|
didit = true;
|
||||||
|
break;
|
||||||
|
case HowToBreak.EthernetCorrupt:
|
||||||
|
break;
|
||||||
|
case HowToBreak.LockOutSwitch:
|
||||||
|
//Lock it out
|
||||||
|
break;
|
||||||
|
case HowToBreak.StaticRouteClear:
|
||||||
|
break;
|
||||||
|
case HowToBreak.StaticRouteCorrupt:
|
||||||
|
break;
|
||||||
|
case HowToBreak.VLANChange:
|
||||||
|
break;
|
||||||
|
case HowToBreak.VPNChangeEndpoint:
|
||||||
|
break;
|
||||||
|
case HowToBreak.VPNChangeKey:
|
||||||
|
break;
|
||||||
|
case HowToBreak.WirelessBreakKey:
|
||||||
|
break;
|
||||||
|
case HowToBreak.WirelessBreakSSID:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return didit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
|
||||||
|
{
|
||||||
|
//find the device name it belongs to
|
||||||
|
//try to break it. If it fails, try a different device.
|
||||||
|
//Fail if we cannot do it
|
||||||
|
int count = 0;
|
||||||
|
while(count < 3)
|
||||||
|
{
|
||||||
|
string host = ThePath.HostnameFromTechnology();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user