sherry Posted September 30, 2005 Share Posted September 30, 2005 How do I get remote mac address using c#, does anybody know the code for this? Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/ Share on other sites More sharing options...
0 jak0bk Posted September 30, 2005 Share Posted September 30, 2005 Simple Answer: You can't. Complex answer: You can, but you need to read the output from "arp -a" command. That might get difficult, depending on how many connections you currently have through your NIC (wireless or wired). Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586598222 Share on other sites More sharing options...
0 azcodemonkey Posted September 30, 2005 Share Posted September 30, 2005 jak0bk said: Simple Answer: You can't.Complex answer: You can, but you need to read the output from "arp -a" command. That might get difficult, depending on how many connections you currently have through your NIC (wireless or wired). 586598222[/snapback] Simpler answer: yes, you can. You can use WMI to query a remote computer for its MAC. https://www.neowin.net/forum/index.php?showtopic=342321&st=0 Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586599482 Share on other sites More sharing options...
0 nonsence Posted October 1, 2005 Share Posted October 1, 2005 shouldn't you just be able to use the arp protocol itself to broadcast out an arp reply for getting a mac address from an ip address? i mean, that's what the protocol is there for. also there is r-arp. which gets you the ip address from the mac address. and i'm nto talking about specific programs that come with an os. i mean the actual protocol that is part of the tcp/ip suite. you should read up on network level programming for this. i know of it, but dont know how to do it myself so i can't help you more then just to point you in the general direction.... Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586601876 Share on other sites More sharing options...
0 azcodemonkey Posted October 1, 2005 Share Posted October 1, 2005 nonsence said: shouldn't you just be able to use the arp protocol itself to broadcast out an arp reply for getting a mac address from an ip address? i mean, that's what the protocol is there for. also there is r-arp. which gets you the ip address from the mac address.and i'm nto talking about specific programs that come with an os. i mean the actual protocol that is part of the tcp/ip suite. you should read up on network level programming for this. i know of it, but dont know how to do it myself so i can't help you more then just to point you in the general direction.... 586601876[/snapback] Yes, you can do it that way, however, what if you want to store only the MAC someplace? If you shell out, you redirect the entire output to a file. With WMI, you can be more selective. Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586602181 Share on other sites More sharing options...
0 jak0bk Posted October 1, 2005 Share Posted October 1, 2005 That is only if you have a login on that computer. WMI requires admin privileges to run any sort of WMI query on a computer, regardless of the scope that you are querying. I could be wrong. If so, correct me. Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586603013 Share on other sites More sharing options...
0 nonsence Posted October 1, 2005 Share Posted October 1, 2005 WMI is supposed to be what Microsofts answer to SNMP is. and yes you do need certain priviledges to get information. and i think it will only work for Windows based systems that run the WMI services, which aren't installed by default. i think if you wanna do this right, you should stick to the tcp/ip standards and figure out how to use to arp protocol to quiry remote systems. I know of packet sniffers that can do this, and programs that build a list of computers on the network, and list their info based on ip, dns/netbios and mac addess. but i dont know the programming behind how they do it. Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586603957 Share on other sites More sharing options...
0 azcodemonkey Posted October 1, 2005 Share Posted October 1, 2005 nonsence said: WMI is supposed to be what Microsofts answer to SNMP is. and yes you do need certain priviledges to get information. and i think it will only work for Windows based systems that run the WMI services, which aren't installed by default.i think if you wanna do this right, you should stick to the tcp/ip standards and figure out how to use to arp protocol to quiry remote systems. I know of packet sniffers that can do this, and programs that build a list of computers on the network, and list their info based on ip, dns/netbios and mac addess. but i dont know the programming behind how they do it. 586603957[/snapback] I'm pretty sure WMI is installed by default starting with 2000. It's a simple way. But, yeah, using TCP/IP would be better for a mixed environment. Here: http://www.c-sharpcorner.com/Code/2003/Jun...cketSniffer.asp Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586605934 Share on other sites More sharing options...
0 sherry Posted October 2, 2005 Author Share Posted October 2, 2005 weenur said: I'm pretty sure WMI is installed by default starting with 2000. It's a simple way. But, yeah, using TCP/IP would be better for a mixed environment.Here: http://www.c-sharpcorner.com/Code/2003/Jun...cketSniffer.asp 586605934[/snapback] Thanks guys for all your help, but I'm looking for the c# code to get a remote mac address without using WMI. Anyone any ideas? Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586609607 Share on other sites More sharing options...
0 azcodemonkey Posted October 3, 2005 Share Posted October 3, 2005 Hey, sherry. I should have pointed out that the link I posted was a link to a C# wrapper for a lib for WinPCap, a very nice packet sniffing tool. The library has a good amount of the protocols used with TCP/IP, including ARP. Link to comment https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/#findComment-586612393 Share on other sites More sharing options...
Question
sherry
How do I get remote mac address using c#, does anybody know the code for this?
Link to comment
https://www.neowin.net/forum/topic/378959-get-remote-mac-address-using-c/Share on other sites
9 answers to this question
Recommended Posts