Thread: Spoof MAC Address.

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    242

    Spoof MAC Address.

    How can I obtain the MAC Address with C? (in Linux and in Windows)
    and how could I change it?

    Hmm...
    I could change my MAC Address in Linux typing this:
    Code:
    ifconfig eth0 down hw ether ff:ff:ff:ff:ff:f0
    and then I'm gonnna need to up the new MAC Address:
    Code:
    ifconfig eth0 up
    In windows, the MAC Address is in the registry:
    Code:
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}
    Then search for NetworkAddress (it's in the 0009 directory)

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    msg erased
    Last edited by nacho4d; 02-07-2008 at 11:01 AM.
    Mac OS 10.6 Snow Leopard : Darwin

  3. #3
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    I can think of an alternative solution

    in the terminal if you use de the "arp" command you can obtain the ethernet address
    for example if you use
    Code:
    arp -a
    you will get all the arp addresses.
    and if you pipe the output to a file (lets say arp.txt)

    Code:
    3:cProg nacho$ arp -a > arp.txt
    and you read the mac (ethernet) address from the file you will have your MAC address.


    you can use system() system call to do it inside your C program

    I am sure there is another and better solution for this. but you can try
    Last edited by nacho4d; 02-07-2008 at 11:10 AM.
    Mac OS 10.6 Snow Leopard : Darwin

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Why do you want to do this?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by eXeCuTeR View Post
    How can I obtain the MAC Address with C? (in Linux and in Windows)
    and how could I change it?
    use ARP to find it

    You cant change it without an EEPROM

  6. #6
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    hummmm....hey. I found a solution at :
    http://www.geekpage.jp/programming/l...et-macaddr.php
    this is in japanese but you can see the code.

    this code shows the MAC address but it uses SIOCGIFHWADDR wich is a LINUX exclusive macro so I couldnt test it.

    Does any one knows about an equivalent for SIOCGIFHWADDR in standard UNIX ?
    good luck
    Mac OS 10.6 Snow Leopard : Darwin

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    again, you didnt say why you need to change it. In general changing it without knowing exactly what you are doing is a bad thing, as it will most likely cause it to conflict with some other NIC

  8. #8
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Quote Originally Posted by abachler View Post
    again, you didnt say why you need to change it. In general changing it without knowing exactly what you are doing is a bad thing, as it will most likely cause it to conflict with some other NIC
    I wanna try ARP Poisoning my laptop
    I know I could change it in other ways but I want to make a program to do the job for me, anytime I want to.

    What is EEPROM?

    Thanks nacho
    Good idea, I'm gonna test it now.

    Now I just gotta find a way to edit MAC Address in Windows.
    Any ideas?

  9. #9
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Anyone?
    How could I change my MAC Address in Windows through C?

    Thanks and sorry.

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    One common reason to want to do this is that some cable internet providers MAC-lock the cable modem to your NIC's MAC when they come on site for installation. If you change your NIC, the modem will no longer allow it to connect.

    As far as ARP poisoning, you do not need to change your hardware MAC to achieve it, but I am not going into any further detail than that.

  11. #11
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    What is EEPROM?
    Its rewritable memory like flash memory; unlike memory thats burnt into a chip and can't be modified.

    That shouldent matter tho as nowadays MAC addresses tend to be set in software rather burnt into the NIC.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to Send Mac Address From Client to Server
    By Lieyza197 in forum C Programming
    Replies: 2
    Last Post: 05-27-2009, 09:58 AM
  2. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  3. How to spoof a MAC address?
    By Lateralus in forum Linux Programming
    Replies: 3
    Last Post: 06-26-2005, 07:50 PM
  4. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM