Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Nmap Development: Re: NMAP and MAC Addresses

Re: NMAP and MAC Addresses

From: Sean <news_nospam__at_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
Received on Jul 24 2004

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos