Unique Identifier Help!

Discussion in 'Mac Programming' started by faffoo, Jul 7, 2011.

  1. faffoo macrumors 6502

    Joined:
    May 22, 2008
    Location:
    Glasgow, UK
    #1
    I am looking for a way to have a UNIQUE identifier for every mac i run my program on. How can i do this?

    Ive found dozens of links to a technote on apples site that doesnt exist any more. So all help is appreciated.

    The MAC address is no good for me.

    Regards
    Matt
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
  3. faffoo thread starter macrumors 6502

    Joined:
    May 22, 2008
    Location:
    Glasgow, UK
    #3
    I have read about using this, but I have also read that if certain components are changed in a Mac the serial number turns to a string of 0's? Is this true? and if so this is no good.

    If that is true, any other suggestions?

    Regards
    Matt
     
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    It's not exactly true.

    What the serial number is changed to is unpredictable. It's not guaranteed to be a string of 0's. It's not guaranteed to even be in the form of a serial number.

    I had a machine repaired under warranty, which replaced the main logic board. It came back with a serial number of the literal string "SystemSerialNumb".

    There's nothing that perfectly meets your criteria. Any replacement of the main logic board can change both the MAC and the serial-number. So you should probably explain what you're trying to accomplish with this unique number, including how unique it must be, how persistent it must be (survive main logic board replaced?), why the MAC is unacceptable, etc. If you're trying to implement a license scheme, then say that.
     
  5. faffoo thread starter macrumors 6502

    Joined:
    May 22, 2008
    Location:
    Glasgow, UK
    #5
    Basically, i need a unique identifier to complete a licensing system. I need it to be as persistant as possible without having to store it both on my web server and the client machine.

    I have read the MAC address can be changed, so id rather avoid that.

    And the thing I initially thought of was the Hardware UUID? is that any good? and if so how can i get that?

    Regards
    Matt
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    Pay for a dongle?

    Who are you trying to defend against? What attackers? What attacks? What is it worth to you for this defense (put an actual dollars/unit figure on it)? If you don't know who you're defending against, or what you're willing to pay to limit it, then you don't know enough to decide on a suitable strategy.

    And even paying for a dongle won't make you immune. Everything can be defeated, given time and inclination. There are people who break licensing schemes for fun. So you also need a response plan and mitigation strategy when your finely honed defense eventually falls to attackers.

    The subject of license registration schemes comes up repeatedly, so this discussion has happened before (and will happen again). Search the MacRumors archives. Example:
    http://forums.macrumors.com/showthread.php?t=852084


    Enter these command lines in Terminal, and look at the output:
    Code:
    system_profiler | grep UUID
    
    ifconfig | grep ether
    
    On my machines, there's a remarkable similarity between the so-called Hardware UUID and the primary (en0) MAC.
     
  7. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #7
    A licensing system must (1) not interfere with licensed use of the software and (2) make sure the licensor does not inadvertently exceed the license. That's what you need to do. To protect against circumvention of the licensing system you use lawyers. With that in mind, using the MAC is fine.
     
  8. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #8
    Interesting. Not so on my MBP 5,3 at least.

    Code:
    Hadrware UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
    MAC: XX:XX:XX:XX:XX:XX (en0, en1) or
    MAC: XX:XX:XX:XX:XX:XX:XX:XX (fw0) 
    
    And none of the sequential bytes in the MACs are also in the UUID.

    I agree with gnasher729, unless you go to a dongle the MAC or HW UUID should do.

    B
     
  9. faffoo thread starter macrumors 6502

    Joined:
    May 22, 2008
    Location:
    Glasgow, UK
    #9
    OK. I think the best approach would be to get the serial number, MAC address, and UUID and combine them all.

    Does anyone know how i can get an NSString of the MAC address? And the UUID if possible? I have the serial number now.

    Regards
    matt
     
  10. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #10
    GetPrimaryMACAddress
     
  11. faffoo thread starter macrumors 6502

    Joined:
    May 22, 2008
    Location:
    Glasgow, UK
    #11
    I have seen this and looked at this. My problem is, I have no knowledge of C at all, and this is a C class. I am working in pure Objective C Cocoa, could you please tell me how I could utilise this to get an NSString that contains the MacAddress?

    All help is appreciated.

    Regards
    Matt
     
  12. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #12
    If you don't want to make use of C libraries you could cheat and use NSTask or NSPipe and stick the output of "ifconfig eth0" into an NSString that way.

    ;)

    B
     
  13. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #13
    See this thread:
    http://forums.macrumors.com/showthread.php?t=689645

    Found with google search terms:
    get MAC address programming site:forums.macrumors.com

    get MAC address - because that's the info wanted.
    programming - to search only programming forums.
    site:forums.macrumors.com - for site-specific search.

    And you should learn enough C to know what function calls and type declarations look like. Otherwise you're at a serious disadvantage when it comes to even simple stuff like printf().


    On the general subject of license schemes, try search terms such as:
    programming license site:forums.macrumors.com
     

Share This Page