0

I made a program, and for "protection" set some parameters. First parameter is date to wich program can work (something Trial but with fixed date), and the second one is HDD serial number (had some problems with other hardware serials) on which program works.

Now, I need to make it possible to me to change these values after compiling program. I tried adding Log in which accepts anything and executes program with default values. Only if I log in with my user/pass values, it somehow allows me to change default values. After that, by every start of program, he checks with new values I've entered earlier.

If someone understands what I want and what I tried, tell me is this possible, or is there some other and easier/better solution?

Aleksandar
  • 1,163
  • 22
  • 41
  • You could store the values somehow encrypted in some property file where the program reads them from and build a form for admins to log in and change the values of this property file. – Smutje Feb 28 '14 at 11:27

1 Answers1

0
  1. put your "constant" part in a String which will must have a fixed size
  2. that string should have only ASCII code; for max flexibility I'd use a base64 encoded string, so you can put even binary encripyted data
  3. compile the class
  4. if you open the .class with an hexadecimal editor, you are able to see and change that string
  5. edit the .class file by that hexadecimal editor, putting the new ASCII values. Keep attention not to change the size of the String

Note also that this approach can be hackable by some guys :)

robermann
  • 1,722
  • 10
  • 19
  • Of course you can automatize this task by editing a .class via a java.io.RandomAccessFile, overwriting the String's bytes – robermann Feb 28 '14 at 11:33
  • My mistake, forgot to mention. I use one program which make installation for my program, because I want to hide code from extracting from jar or editing (because of some guys :D). So, I need to find the way to change parameters after making installation file. This is because I'm tring to bypass making installation everytime for new user, by doing this. Sorry for mistake. :/ – Aleksandar Feb 28 '14 at 11:38
  • 1) Your installer wizard could write in a binary Windows registry key some data, and your Java code can read it. 2) you can get that installation code via https: the first run of the code, download a key from your site. – robermann Feb 28 '14 at 11:41
  • Both hackable, anyway. – robermann Feb 28 '14 at 11:42
  • I think I understand you. I will try. It doesnt need to be very very secure, just not to be obvious for simple man to easily google the way to track me. – Aleksandar Feb 28 '14 at 11:44
  • If this can help, an approach I saw in the past was serializing a Java bean into a binary registry key: so that instance could be preinstalled with getters returning a default value (for example, millisec used in a countdown, days of trial period) or updated with runtime data (remaining free days etc) – robermann Feb 28 '14 at 12:55