1
neroxps 2023-03-13 20:34:02 +08:00 via iPhone
蹲个工具
|
2
ppbaozi OP |
3
ppbaozi OP |
4
ppbaozi OP ```
using System.Net; using System.Net.NetworkInformation; // Get the list of network interfaces NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); // Loop through each interface foreach (NetworkInterface ni in interfaces) { // Check if the interface is an IPv6 interface if (ni.Supports(NetworkInterfaceComponent.IPv6)) { // Get the list of IPv6 addresses for the interface IPAddressCollection addresses = ni.GetIPProperties().UnicastAddresses; // Loop through each IPv6 address foreach (IPAddress address in addresses) { // Check if the address is an IPv6 address if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) { // Get the list of neighbors for the address IPv6NeighborCollection neighbors = ni.GetIPv6Properties().GetIPv6Neighbors(address); // Loop through each neighbor foreach (IPv6Neighbor neighbor in neighbors) { // Display the neighbor's IP address and MAC address Console.WriteLine("Neighbor IP Address: {0}", neighbor.Address); Console.WriteLine("Neighbor MAC Address: {0}", neighbor.LinkLayerAddress); } } } } } ``` |