Nmap Development mailing list archives
Re: NMAP and MAC Addresses
From: "Sean" <news_nospam_ () warnocksolutions com>
Date: Sat, 24 Jul 2004 11:10:19 -0700
A beggining. Sorry I cannot do any better than this as I am not a programmer but this might be enough for someone else to get started. This came from Microsoft's MSDN site from the following UR: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/sendarp.asp
I hope this helps and I am sorry I cannot do more.
Sean
//
// Link with ws2_32.lib and iphlpapi.lib
//
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <iphlpapi.h>
int __cdecl main()
{
HRESULT hr;
IPAddr ipAddr;
ULONG pulMac[2];
ULONG ulLen;
ipAddr = inet_addr ("192.168.25.31");
memset (pulMac, 0xff, sizeof (pulMac));
ulLen = 6;
hr = SendARP (ipAddr, 0, pulMac, &ulLen);
printf ("Return %08x, length %8d\n", hr, ulLen);
size_t i, j;
char * szMac = new char[ulLen*3];
PBYTE pbHexMac = (PBYTE) pulMac;
//
// Convert the binary MAC address into human-readable
//
for (i = 0, j = 0; i < ulLen - 1; ++i) {
j += sprintf (szMac + j, "%02X:", pbHexMac[i]);
}
sprintf (szMac + j, "%02X", pbHexMac[i]);
printf ("MAC address %s\n", szMac);
delete [] szMac;
return 0;
}
---------------------------------------------------------------------For help using this (nmap-dev) mailing list, send a blank email to nmap-dev-help () insecure org . List archive: http://seclists.org
Current thread:
- NMAP and MAC Addresses Alan Jones (Jul 23)
- Re: NMAP and MAC Addresses Fyodor (Jul 23)
- Re: NMAP and MAC Addresses Alan S. Jones (Jul 24)
- <Possible follow-ups>
- Re: NMAP and MAC Addresses Sean (Jul 24)
- Re: NMAP and MAC Addresses Fyodor (Jul 23)
