track additional information so we can tell which nic to break, which route to break, etc

This commit is contained in:
Tim Young 2017-08-26 14:56:50 -05:00
parent ea3f2adb65
commit c6bee193ce
5 changed files with 27 additions and 12 deletions

View File

@ -90,7 +90,7 @@ namespace EduNetworkBuilder
packet_in=4, packet_out=8, packet_duplicate=16, all=63,
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}
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived, network_interface}
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, LockOutSwitch,
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}

View File

@ -1919,35 +1919,47 @@ namespace EduNetworkBuilder
switch(How)
{
case HowToBreak.PowerOff:
//power the device off
tDevice.PowerOff = true;
didit = 1;
break;
case HowToBreak.DeviceChangeGW:
//Change the IP of the gateway
break;
case HowToBreak.DeviceChangeIP:
//Change the IP on the outbound nic
break;
case HowToBreak.EthernetBreak:
//break the link itself
tLink.theLinkType = LinkType.broken;
didit = 1;
break;
case HowToBreak.EthernetCorrupt:
//Add a flourescent light
break;
case HowToBreak.LockOutSwitch:
//Lock it out
break;
case HowToBreak.StaticRouteClear:
//Clear out the static route(s)
break;
case HowToBreak.StaticRouteCorrupt:
//corrupt the static route(s)
break;
case HowToBreak.VLANChange:
//Change the vlan on the port we use.
break;
case HowToBreak.VPNChangeEndpoint:
//Change the ip-address on the VPN endpoint
break;
case HowToBreak.VPNChangeKey:
//change the key for the VPN encryption
break;
case HowToBreak.WirelessBreakKey:
//Change the wireless key
break;
case HowToBreak.WirelessBreakSSID:
//change the wireless ssid - have small list of bad keys to choose from
break;
}
return didit;

View File

@ -1504,7 +1504,7 @@ namespace EduNetworkBuilder
tPacket.MyStatus = PacketStatus.finished_failed;
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)
{
//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
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;
}
else
@ -1636,7 +1636,7 @@ namespace EduNetworkBuilder
//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))
{
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.forward);
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.forward,"");
if (nic.SendPacketOutNIC(tPacket))
{
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.OriginalDestIP = tPacket.destIP;
nPacket.isFresh = true; //So it starts from here
@ -1847,7 +1847,7 @@ namespace EduNetworkBuilder
}
else
{
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived);
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.arrived,"");
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.MyStatus = PacketStatus.finished_ok;
@ -1882,7 +1882,7 @@ namespace EduNetworkBuilder
//Console.WriteLine("Tracert: " + tPacket.OrigTTL + " " + tPacket.sourceIP.GetIPString);
//Console.WriteLine("Tracert: -- " + tPacket.sourceIP.GetIPString + " " + origStart.GetIPString);
//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);

View File

@ -206,6 +206,7 @@ namespace EduNetworkBuilder
string hostname = HD.hostname;
//added to fix the issue with vpns and pings - 11-09-2016
//Only do this on non-ports?
tPacket.TraversalInformation.AddPath(hostname, TraversalTechnology.network_interface, nic_name);
NetworkCard nic = HD.NicFromID(AttachedToHostNic);
if(nic != null && nic.GetNicType != NicType.port && nic.GetNicType != NicType.wport)
tPacket.TsourceIP = myIP;
@ -334,8 +335,8 @@ namespace EduNetworkBuilder
NetworkDevice ND = MyNet.GetDeviceFromID(AttachedToHostNic);
tPacket.InboundInterface = this;
if(isgood)
tPacket.TraversalInformation.AddPath(ND.hostname, TraversalTechnology.network_interface, nic_name);
if (isgood)
{
//anything we should do here?
//Mainly vlan if we are a vlan.

View File

@ -12,11 +12,13 @@ namespace EduNetworkBuilder
{
public string host;
public TraversalTechnology WhatUsed;
public string AdditionalData;
public TraversalRecord(string Host, TraversalTechnology what)
public TraversalRecord(string Host, TraversalTechnology what, string Data)
{
host = Host;
WhatUsed = what;
AdditionalData = Data;
}
}
@ -41,9 +43,9 @@ namespace EduNetworkBuilder
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)
{