track additional information so we can tell which nic to break, which route to break, etc
This commit is contained in:
parent
ea3f2adb65
commit
c6bee193ce
@ -90,7 +90,7 @@ namespace EduNetworkBuilder
|
|||||||
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 { any, none, 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, network_interface}
|
||||||
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
|
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
|
||||||
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
|
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
|
||||||
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}
|
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}
|
||||||
|
@ -1919,35 +1919,47 @@ namespace EduNetworkBuilder
|
|||||||
switch(How)
|
switch(How)
|
||||||
{
|
{
|
||||||
case HowToBreak.PowerOff:
|
case HowToBreak.PowerOff:
|
||||||
|
//power the device off
|
||||||
tDevice.PowerOff = true;
|
tDevice.PowerOff = true;
|
||||||
didit = 1;
|
didit = 1;
|
||||||
break;
|
break;
|
||||||
case HowToBreak.DeviceChangeGW:
|
case HowToBreak.DeviceChangeGW:
|
||||||
|
//Change the IP of the gateway
|
||||||
break;
|
break;
|
||||||
case HowToBreak.DeviceChangeIP:
|
case HowToBreak.DeviceChangeIP:
|
||||||
|
//Change the IP on the outbound nic
|
||||||
break;
|
break;
|
||||||
case HowToBreak.EthernetBreak:
|
case HowToBreak.EthernetBreak:
|
||||||
|
//break the link itself
|
||||||
tLink.theLinkType = LinkType.broken;
|
tLink.theLinkType = LinkType.broken;
|
||||||
didit = 1;
|
didit = 1;
|
||||||
break;
|
break;
|
||||||
case HowToBreak.EthernetCorrupt:
|
case HowToBreak.EthernetCorrupt:
|
||||||
|
//Add a flourescent light
|
||||||
break;
|
break;
|
||||||
case HowToBreak.LockOutSwitch:
|
case HowToBreak.LockOutSwitch:
|
||||||
//Lock it out
|
//Lock it out
|
||||||
break;
|
break;
|
||||||
case HowToBreak.StaticRouteClear:
|
case HowToBreak.StaticRouteClear:
|
||||||
|
//Clear out the static route(s)
|
||||||
break;
|
break;
|
||||||
case HowToBreak.StaticRouteCorrupt:
|
case HowToBreak.StaticRouteCorrupt:
|
||||||
|
//corrupt the static route(s)
|
||||||
break;
|
break;
|
||||||
case HowToBreak.VLANChange:
|
case HowToBreak.VLANChange:
|
||||||
|
//Change the vlan on the port we use.
|
||||||
break;
|
break;
|
||||||
case HowToBreak.VPNChangeEndpoint:
|
case HowToBreak.VPNChangeEndpoint:
|
||||||
|
//Change the ip-address on the VPN endpoint
|
||||||
break;
|
break;
|
||||||
case HowToBreak.VPNChangeKey:
|
case HowToBreak.VPNChangeKey:
|
||||||
|
//change the key for the VPN encryption
|
||||||
break;
|
break;
|
||||||
case HowToBreak.WirelessBreakKey:
|
case HowToBreak.WirelessBreakKey:
|
||||||
|
//Change the wireless key
|
||||||
break;
|
break;
|
||||||
case HowToBreak.WirelessBreakSSID:
|
case HowToBreak.WirelessBreakSSID:
|
||||||
|
//change the wireless ssid - have small list of bad keys to choose from
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return didit;
|
return didit;
|
||||||
|
@ -1504,7 +1504,7 @@ namespace EduNetworkBuilder
|
|||||||
tPacket.MyStatus = PacketStatus.finished_failed;
|
tPacket.MyStatus = PacketStatus.finished_failed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.ip_address); //We will use an outbound ip.
|
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.ip_address,""); //We will use an outbound ip.
|
||||||
if (dest.GetIP == tPacket.destIP.GetIP)
|
if (dest.GetIP == tPacket.destIP.GetIP)
|
||||||
{
|
{
|
||||||
//It is a local packet. Let it go out the interface it needs to go out
|
//It is a local packet. Let it go out the interface it needs to go out
|
||||||
@ -1515,7 +1515,7 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
//it needs to go to a gateway. Set the next destination is the GW
|
//it needs to go to a gateway. Set the next destination is the GW
|
||||||
tPacket.OutboundIP = dest;
|
tPacket.OutboundIP = dest;
|
||||||
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.gateway); //We just used a gateway
|
tPacket.TraversalInformation.AddPath(this.hostname, TraversalTechnology.gateway,""); //We just used a gateway
|
||||||
tPacket.TsourceIP = null;
|
tPacket.TsourceIP = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1636,7 +1636,7 @@ namespace EduNetworkBuilder
|
|||||||
//But if we do not know a dnic, send it out all of them (except the sNic)
|
//But if we do not know a dnic, send it out all of them (except the sNic)
|
||||||
if (sNic != nic && (tdNic == null || (tdNic != null && tdNic.ConnectedLink == -1) || tdNic == nic))
|
if (sNic != nic && (tdNic == null || (tdNic != null && tdNic.ConnectedLink == -1) || tdNic == nic))
|
||||||
{
|
{
|
||||||
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.forward);
|
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.forward,"");
|
||||||
if (nic.SendPacketOutNIC(tPacket))
|
if (nic.SendPacketOutNIC(tPacket))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
@ -1778,7 +1778,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived);
|
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived,"");
|
||||||
nPacket = new Packet(this, tPacket.sourceIP, "", PacketType.ping_answer, tPacket.packetID);
|
nPacket = new Packet(this, tPacket.sourceIP, "", PacketType.ping_answer, tPacket.packetID);
|
||||||
nPacket.OriginalDestIP = tPacket.destIP;
|
nPacket.OriginalDestIP = tPacket.destIP;
|
||||||
nPacket.isFresh = true; //So it starts from here
|
nPacket.isFresh = true; //So it starts from here
|
||||||
@ -1847,7 +1847,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived);
|
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived,"");
|
||||||
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReturn1"));
|
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReturn1"));
|
||||||
tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrSuccessStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString());
|
tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrSuccessStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString());
|
||||||
tPacket.MyStatus = PacketStatus.finished_ok;
|
tPacket.MyStatus = PacketStatus.finished_ok;
|
||||||
@ -1882,7 +1882,7 @@ namespace EduNetworkBuilder
|
|||||||
//Console.WriteLine("Tracert: " + tPacket.OrigTTL + " " + tPacket.sourceIP.GetIPString);
|
//Console.WriteLine("Tracert: " + tPacket.OrigTTL + " " + tPacket.sourceIP.GetIPString);
|
||||||
//Console.WriteLine("Tracert: -- " + tPacket.sourceIP.GetIPString + " " + origStart.GetIPString);
|
//Console.WriteLine("Tracert: -- " + tPacket.sourceIP.GetIPString + " " + origStart.GetIPString);
|
||||||
//If we had not landed on the actual dest...
|
//If we had not landed on the actual dest...
|
||||||
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived);
|
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived,"");
|
||||||
|
|
||||||
tracertmessages.Add(NB.Translate("ND_ProcessArrival_TracertReply") + " " + tPacket.sourceIP.GetIPString);
|
tracertmessages.Add(NB.Translate("ND_ProcessArrival_TracertReply") + " " + tPacket.sourceIP.GetIPString);
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@ namespace EduNetworkBuilder
|
|||||||
string hostname = HD.hostname;
|
string hostname = HD.hostname;
|
||||||
//added to fix the issue with vpns and pings - 11-09-2016
|
//added to fix the issue with vpns and pings - 11-09-2016
|
||||||
//Only do this on non-ports?
|
//Only do this on non-ports?
|
||||||
|
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.network_interface, nic_name);
|
||||||
NetworkCard nic = HD.NicFromID(AttachedToHostNic);
|
NetworkCard nic = HD.NicFromID(AttachedToHostNic);
|
||||||
if(nic != null && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport)
|
if(nic != null && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport)
|
||||||
tPacket.TsourceIP = myIP;
|
tPacket.TsourceIP = myIP;
|
||||||
@ -334,7 +335,7 @@ namespace EduNetworkBuilder
|
|||||||
NetworkDevice ND = MyNet.GetDeviceFromID(AttachedToHostNic);
|
NetworkDevice ND = MyNet.GetDeviceFromID(AttachedToHostNic);
|
||||||
|
|
||||||
tPacket.InboundInterface = this;
|
tPacket.InboundInterface = this;
|
||||||
|
tPacket.TraversalInformation.AddPath(ND.hostname, TraversalTechnology.network_interface, nic_name);
|
||||||
if (isgood)
|
if (isgood)
|
||||||
{
|
{
|
||||||
//anything we should do here?
|
//anything we should do here?
|
||||||
|
@ -12,11 +12,13 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
public string host;
|
public string host;
|
||||||
public TraversalTechnology WhatUsed;
|
public TraversalTechnology WhatUsed;
|
||||||
|
public string AdditionalData;
|
||||||
|
|
||||||
public TraversalRecord(string Host, TraversalTechnology what)
|
public TraversalRecord(string Host, TraversalTechnology what, string Data)
|
||||||
{
|
{
|
||||||
host = Host;
|
host = Host;
|
||||||
WhatUsed = what;
|
WhatUsed = what;
|
||||||
|
AdditionalData = Data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,9 +43,9 @@ namespace EduNetworkBuilder
|
|||||||
dest.PathTaken.AddRange(source.PathTaken);
|
dest.PathTaken.AddRange(source.PathTaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPath(string Host, TraversalTechnology WithWhat)
|
public void AddPath(string Host, TraversalTechnology WithWhat, string Data)
|
||||||
{
|
{
|
||||||
PathTaken.Add(new TraversalRecord(Host, WithWhat));
|
PathTaken.Add(new TraversalRecord(Host, WithWhat, Data));
|
||||||
}
|
}
|
||||||
public void AddPath(TraversalClass OtherTraversal)
|
public void AddPath(TraversalClass OtherTraversal)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user