Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Restricting Java application to run one only one machine

 
Ranch Hand
Posts: 160
IntelliJ IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I've been tasked with writing a bit of code to disallow users from running our software on more than one machine, based on a key generated from a unique identifier of the machine (such as a MAC address). Based on a couple of Google searches, it appears that there is not really a sure fire way of preventing users from misusing an application in this way, but the MAC address seems to be the best option.

I've tried getting the MAC address using the following code, but it get gets a null network interface for the localhost address, leaving me unable to find a MAC address.



Does anyone have an idea how I can get the MAC address, or an alternate solution to the problem?

Thanks!
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In JDK 1.6 a new method is added in the java.net.NetworkInterface class;

Useful links are as follows;
  • Listing Network
  • Broadcasting to Multiple Recipients
  •  
    Rancher
    Posts: 43027
    76
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Is this an application where the customer has access to the class files? If so, be aware that it's not all that hard for a determined attacker to patch out any part of the software (like the machine check) using a decompiler. Any such scheme merely makes it harder.
     
    Riaan Nel
    Ranch Hand
    Posts: 160
    IntelliJ IDE VI Editor Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Amit Vinod Dali wrote:In JDK 1.6 a new method is added in the java.net.NetworkInterface class;


    Hi Amit

    Thank you for your response. That is indeed the method that I was trying to use later on in my code, however, I could not get an instance of NetworkInterface, as

    was returning null.

    Ulf, I thought about the exact same thing. I suspect that any clown with a decompiler and basic knowledge of Java will be able to crack the application. However, this basic solution should prevent the majority (I'd say 99%) of our users from using the application on multiple machines.

    Regards,
    Riaan

    P.S. I've solved the problem by looping through the result of until I find a network interface with a MAC address.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic