Just looking for a job, the manager would let me compile a program that produces a software registration code. Best is that I have never edited Dongdong, I have always feel that the registration code is very mysterious, I don't expect it to work on the first day. Just hit this kind of thing. Helpless. Look online. Relevant information. In short, you will first get some hardware information, then encrypt.
After I found a lot of related information online, I used VC6.0 to get a program that got the network card address and hard disk physical serial number. This plan is called by JNI, and later discovered that the IDE hard disk physical serial number can only be under administrator privileges. Get it. Hey ~~~ White is busy for half a day.
Later, after the manager, the manager made me use Mac Address. So I will refer to some of the code given by my predecessors, write the following applet.
Basic ideas is to call the operating system command. Encryption is not posted ~~~~
Import java.io.bufferedreader; import java.io.inputstreamReader; import java.io iexception; import java.lang. *;
// Judgment Operating System Type Class getosName {public string getoperatesysName () {os = system.getProperty ("os.name"); // Get operating system type return OS;} / * public static void main (String [] args {GetosName osname = new getosName (); string name = osname.GetoperateSysName ();} * / private string Os;
// obtain card information public class GetMacAddress {public String GetMacAddress () {String osname = ""; GetOSname getosname = new GetOSname (); osname = getosname.GetOperateSysName (); if (osname == null) {System.out.println ("Can't get opreate system property"); system.exit (0);} if (OsName.StartSwith ("Windows")) {Try {command = "ipconfig / all"; // Defines the system command P = runtime .getruntime (). EXEC (Command); // Execute Command Br = New BufferedReader (p.GetInputStream ()))))); // Redirect the output stream to the buffer string line; while ((line = Br. Readline ())! = NULL) // Resolution Address {IF ("Physical Address"> 0) {INDEX = line.indexof (":"); index = 2; address = line.substring (index); Break;}} br.close (); Return Address.Trim ();} Catch (ioException e) {}} else // Linux analysis flow {if ("Linux")) {Try {command = "ifconfig"; p = runtime.getime (). EXEC ( Command; br = new bufferedreader (p.GetInputStream ()))))); string line; while ((line = br.readline ())! = null) {if (line.indexof ("hwadd")> 0 ) {INDEX = line.lastIndexof (":"); index = 2;
Address = line.substring (index); Break;}} br.close (); return address.trim ();} catch (ooException e) {} //system.out.println ("linux ");}}} return address;} public static void main (String [] args) {getMacAddress getmacaddress = new getMacAddress (); String macadd; macadd = getmacaddress.GetMacAddress (); System.out.println (macadd);} private String address = ""; Private string command = ""; private process p = null; private buffreader br;} I have not debugged in that section on Linux, and others can run.
Special thanks to the seniors who gave me helping me, a lot of code is they posted, I just made a little job.
Hey, you can lie to the manager, you will do it ~~~~ Everyone can bless me to become a hero, huh, huh, huh