dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: MAC filtering

  1. #1
    Join Date
    Nov 2006
    Posts
    290

    MAC filtering

    Hi all, im working on a security product and i need to know how to make a prog that will allow me to filter out MAC addresses. I was hoping someone here would point me in the right direction. I do it all the time on my router, i'd just like to know if there is some way to tell the MAC address of a connected machine. Suppose i have a UDP program that binded to a port which another TCP program connected to, i'd like to find out what that MAC address is of the machine connected. Any help on this is greatly appreciated, google isnt helping much. Thanx in advance!

  2. #2
    Join Date
    Apr 2008
    Posts
    726

    Re: MAC filtering

    if you type
    Code:
    arp -a
    into a console window when everything is connected, do you get the information that you want?

  3. #3
    Join Date
    Nov 2006
    Posts
    290

    Re: MAC filtering

    No i get

    Code:
    No ARP Entries Found

  4. #4
    Join Date
    Apr 2008
    Posts
    726

    Re: MAC filtering

    I've got no idea then. I'm not certain, but I don't think you're guaranteed that information from what you have said.

  5. #5
    Join Date
    Aug 2007
    Location
    Birmingham, UK
    Posts
    360

    Re: MAC filtering

    Amleto is correct - this is exactly what ARP is designed for. If you use a network analyser like Wireshark then you can see this in action. When your computer wants to connect to a computer with IP address 10.0.0.4 then you'll see it broadcast an ARP request "who has IP 10.0.0.4"? The computer with address 10.0.0.4 will then respond so that your computer now knows the MAC address to send the answer to.

    Please note that this only works for local network nodes. You cannot get the MAC addresses of computers on the other side of a router or firewall, like servers on the Internet for example.

  6. #6
    Join Date
    Nov 2006
    Posts
    290

    Re: MAC filtering

    Im familiar with Address Resolution Protocol. I just needed to find a way to copy cat a wireless routers MAC filtering function. Also "arp -a" didnt return anything the first time, but it did once i rebooted my machine. Where would i start to run the command and some how 'read' the output with out the use of fstream?

  7. #7
    Join Date
    Apr 2008
    Posts
    726

    Re: MAC filtering

    if only fstream is prohibited, you could still arp -a, save results to file, then read the file using C style fscanf. why can't you use fstream? I dont know how to do it more directly, sorry.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)