jeb2 demo keygen.md
2016-09-17 12:59
162 查看
如果demo版本过期了,可以尝试用这个keygen
import java.io.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; import java.util.Scanner; /** * description: jeb2 keygen * author: xiaobai * data: 2016/9/1 */ public class Keygen { private long[] getMachineSerialNumber() { long l[] = new long[2]; String platform = System.getProperty("os.name", ""); if (platform.startsWith("Windows")) { String string = getWinSerialNumber("wmic csproduct get uuid", "UUID"); string += "__"; String SerialNumber = getWinSerialNumber("wmic bios get serialnumber", "SerialNumber"); string += SerialNumber; l[0] = getStringMd5(string); l[1] = getStringMd5(SerialNumber); return l; } else if (platform.startsWith("Mac")) { l[0] = getStringMd5(getMacSerialNumber()); l[1] = 0; return l; } else if (platform.startsWith("Linux")) { l[0] = getStringMd5(getLinuxSerialNumber()); l[1] = 0; return l; } return null; } private long getStringMd5(String str) { final MessageDigest instance; try { instance = MessageDigest.getInstance("MD5"); instance.update(str.getBytes()); final ByteBuffer wrap; (wrap = ByteBuffer.wrap(instance.digest())).order(ByteOrder.LITTLE_ENDIAN); return wrap.getLong() & Long.MAX_VALUE; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return 0; } private String getMacSerialNumber() { try { Process exec = Runtime.getRuntime().exec("/usr/sbin/system_profiler SPHardwareDataType".split(" ")); OutputStream outputStream = exec.getOutputStream(); InputStream inputStream = exec.getInputStream(); try { String readLine; String str; outputStream.close(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String IP = "Serial Number"; while (true) { try { readLine = bufferedReader.readLine(); if (readLine != null) { if (readLine.indexOf(IP) >= 0) { break; } } break; } catch (IOException e) { str = e.toString(); return null; } finally { try { inputStream.close(); } catch (IOException e2) { return null; } } } str = readLine.split(IP)[1]; int indexOf = str.indexOf(58); if (indexOf >= 0) { str = str.substring(indexOf + 1).trim(); return str; } return str; } catch (IOException e3) { return null; } } catch (IOException e4) { return null; } } private String getLinuxSerialNumber() { try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("/var/lib/dbus/machine-id"))); String readLine; try { readLine = bufferedReader.readLine(); if (readLine != null) { readLine = readLine.trim(); } else { readLine = null; } return readLine; } catch (IOException e) { readLine = e.toString(); return null; } finally { try { bufferedReader.close(); } catch (IOException e2) { return null; } } } catch (FileNotFoundException e3) { return null; } } private String getWinSerialNumber(String str, String str2) { String str3 = null; try { Process execd = Runtime.getRuntime().exec(str.split(" ")); OutputStream outputStream = execd.getOutputStream(); InputStream inputStream = execd.getInputStream(); outputStream.close(); Scanner scanner = new Scanner(inputStream); do { try { if (!scanner.hasNext()) { break; } } catch (Throwable th) { scanner.close(); } } while (!str2.equals(scanner.next())); str3 = scanner.next().trim(); scanner.close(); } catch (IOException e2) { System.out.println(e2.toString()); } return str3; } public String getKeys() { Random random = new Random(System.currentTimeMillis()); long time = 1624054740 + random.nextInt(10000000); int n1 = (int) (time ^ 0x56739ACD);//有效期 int i = n1; int n = 0;//有效期验证 while (i > 0) { n += (i & 0xF); i >>= 4; } long[] md5s = getMachineSerialNumber(); long md5 = 0;//取其中一个即可 if (md5s[0] != 0) { md5 = md5s[0]; } else { md5 = md5s[1]; } int n3 = (int) md5;//取long后八位 int n4 = (int) (md5 >> 32);//前八位 int n8 = n4 - 28363537 + 1432778632 & Integer.MAX_VALUE;//前八位最终结果 int n7 = n3 + 1173498386 + 287454020;//后八位最终结果 String test = String.format("%x", n8) + String.format("%x", n7);//拼接 String keys = Long.parseLong(test, 16) + "Z" + n1 + n % 10; //System.out.println(keys); return keys; } public static void main(String[] args) { Keygen keygen = new Keygen(); String key= keygen.getKeys(); System.out.println("key:"+key); } }
测试了win下的,linux mac下没条件测试
相关文章推荐
- 遵循MD的Demo实现(TextInputLayout和FloatingActionButton)
- 史上最适合 MVP 初学者学习的 DEMO,整体运用 OKhttp+Mvp+MD 风格设计
- 1-2(补充)新手必备Demo的介绍(初稿).md
- 获取小程序码(JavaDemo)
- WinForm"不错的Vista风格水晶按钮"控件使用(附:源码demo) 之配餐系统的开发
- Android基础之退出应用程序Demo
- SpringMVC+SpringJDBC搭建的项目Demo
- iOS小demo之无限后台
- ASP.NET ZERO 学习 —— (11) 应用开发Demo之创建应用服务
- java8 Limbda表达式的演化demo
- 8.2 Android Basic 数据存储 Database SQLite Demo 2
- 一个简单但完整的NDK demo
- Angularjs制作简单的路由功能demo
- MD文件如何打开
- jQuery插件HighCharts绘制的基本折线图效果示例【附demo源码下载】
- StarStudio 第三周 简单用户注册登录界面Register Demo2
- Bootstrap下的轮播图.md
- Windows Phone 7 使用Perst数据库的Demo——流水账
- Pushler初级Demo2 - 服务器端主动推送消息