用于生成机器码
感觉用mac不靠谱,因为mac能改,
(除CPU序列号外,还可以获得主板序列号。)
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
long start = System.currentTimeMillis();
Process process = Runtime.getRuntime().exec(
new String[] { "wmic", "cpu", "get", "ProcessorId" });
process.getOutputStream().close();
Scanner sc = new Scanner(process.getInputStream());
String property = sc.next();
String serial = sc.next();
System.out.println(property + ": " + serial);
System.out.println("time:" + (System.currentTimeMillis() - start));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
ProcessorId: BFEBFBFF00030***
time:291
再用MD5加密下就成机器码了,不加密也行。
java MD5加密工具类
http://happyqing.iteye.com/blog/1771769
java RSA加密生成license
http://happyqing.iteye.com/blog/2083360