What's new

.NET How to pull device name from IP address in C#

M

Mnx

¿♤? °《Bot》°
Messages
1,721
Reaction score
1,603
Making own version of Netcut. Need to get the Machine Name from given IP Address that's found on internal network.

Could I just use the DNS function inside "System.Net" or is there a better solution? Maybe even a ping class?


Currently I am sending requests to pull all IP on the network

C#:
 #region send request for IP's on internal network
            new Thread(() =>
             {
                 try
                 {
                     for (int ipindex = 1; ipindex <= 255; ipindex++)
                     {
                         ARPPacket arprequestpacket = new ARPPacket(ARPOperation.Request, PhysicalAddress.Parse("00-00-00-00-00-00"), IPAddress.Parse(GetRootIp(myipaddress) + ipindex), capturedevice.MacAddress, myipaddress);
                         EthernetPacket ethernetpacket = new EthernetPacket(capturedevice.MacAddress, PhysicalAddress.Parse("FF-FF-FF-FF-FF-FF"), EthernetPacketType.Arp);
                         ethernetpacket.PayloadPacket = arprequestpacket;
                         capturedevice.SendPacket(ethernetpacket);
                     }
 
Last edited:
Top Bottom