J
Jay
I need to write a program to find mac address of a remote computer, is
this possible? How?
this possible? How?
I need to write a program to find mac address of a remote computer, is
this possible? How?
Jay said:I need to write a program to find mac address of a remote computer, is
this possible? How?
Jay said:I need to write a program to find mac address of a remote computer, is
this possible? How?
this possible? How?
In said:Ping between both computers and run "arp" on one side if you got Linux or
similar.
Jay said:I need to write a program to find mac address of a remote computer, is
this possible? How?
#include <stdio.h>
int main(void)
{
char mac_address[257];
^^^^^^^^^^^^^printf("Enter the MAC address of the remote computer: ");
fflush(stdin);
fgets(mac_address,sizeof(mac_address), stdin);
if (mac_address[strlen(mac_address) - 1] == '\n')
mac_address[strlen(mac_address) - 1] = 0;
printf("The MAC address of the remote computer is %s\n",
mac_address);
return 0;
}
Joona said:^^^^^^^^^^^^^
Undefined behaviour. Because of this, the program might completely
fail to display the given MAC address.
I need to write a program to find mac address of a remote computer, is
this possible? How?
rsh remoteHost sbin/ifconfig | grep "^eth0"
PeterW said:Originally posted by Jay
If you can run a remote shell on the machine, you can run ifconfig and
parse the result with grep from the standard output.
eth0 Link encap:Ethernet HWaddr 00:0D:29:A8:80:44
You can use cut or awk to extract the MAC hardware address.
Joona I Palaste said:Which part of this had anything at all to do with C?
ifconfig, grep, cut, and awk are all C programs.
ifconfig, grep, cut, and awk are all C programs.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.