public void AddNeighbor(Neighbor neighbor) { NeighborEventArgs ea; if (neighbor.physicalAddress == null) { throw new Exception("Neighbor without physical address"); } if (neighbor.physicalAddress.Equals(device.Interface.MacAddress)) { return; } lock (neighborLock) { if (ExistsNeighbor(neighbor)) { Neighbor newNeighbor = GetNeighbor(neighbor.physicalAddress); newNeighbor.Combine(neighbor); ea = new NeighborEventArgs(newNeighbor); ea.Tipo = NeighborOperacionTreeView.Actualizar; NewNeighbor(newNeighbor, ea); return; } if (neighbor.GetIPs().Count == 0) { throw new Exception("Neighbor without ips"); } neighbors.Add(neighbor); ea = new NeighborEventArgs(neighbor); ea.Tipo = NeighborOperacionTreeView.Añadir; NewNeighbor(neighbor, ea); } ReverseResolutionAsync(neighbor); // Resolucion de nombre a partir de IP _CheckIfNeighborRoutesPackets(neighbor); }
private void OnNewNeighbor(NeighborEventArgs e) { EventHandler<NeighborEventArgs> handler = NewNeighbor; if (handler != null) { if (!e.Neighbor.physicalAddress.Equals(localPhysicalAddress)) handler(this, e); } }
public void AddNeighbor(Neighbor neighbor) { NeighborEventArgs ea; if (neighbor.physicalAddress == null) throw new Exception("Neighbor without physical address"); if (neighbor.physicalAddress.Equals(device.Interface.MacAddress)) return; lock (neighborLock) { if (ExistsNeighbor(neighbor)) { Neighbor newNeighbor = GetNeighbor(neighbor.physicalAddress); newNeighbor.Combine(neighbor); ea = new NeighborEventArgs(newNeighbor); ea.Tipo = NeighborOperacionTreeView.Actualizar; NewNeighbor(newNeighbor, ea); return; } if (neighbor.GetIPs().Count == 0) throw new Exception("Neighbor without ips"); neighbors.Add(neighbor); ea = new NeighborEventArgs(neighbor); ea.Tipo = NeighborOperacionTreeView.Añadir; NewNeighbor(neighbor, ea); } ReverseResolutionAsync(neighbor); // Resolucion de nombre a partir de IP _CheckIfNeighborRoutesPackets(neighbor); }
void pasiveScan_NewNeighbor(object sender, NeighborEventArgs e) { if (!(e.Neighbor.physicalAddress.Equals(Program.CurrentProject.data.GetDevice().Interface.MacAddress))) Program.LogThis("New neighbor detected with " + e.Neighbor.physicalAddress.ToString() + " as physical address", Logs.Log.LogType.NeighborSpoofing); }