import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class MyEclipseKeyGen { private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself."; public String getSerial(String userId, String type) { NumberFormat nf = new DecimalFormat("000"); Calendar cal = Calendar.getInstance(); cal.add(Calendar.YEAR, 3); cal.add(Calendar.DAY_OF_YEAR, -1); String licenseNum = nf.format((int) (Math.random() * 1000)); String expTime = new StringBuilder("-").append( new SimpleDateFormat("yyMMdd").format(cal.getTime())).append( "0").toString(); String need = new StringBuilder(userId.substring(0, 1)).append("Y") .append(type).append("-100").append(licenseNum).append(expTime) .toString(); String dx = new StringBuilder(need).append(LL).append(userId) .toString(); int suf = this.decode(dx); String code = new StringBuilder(need).append(String.valueOf(suf)) .toString(); return this.change(code); } private int decode(String s) { int i; char[] ac; int j; int k; i = 0; ac = s.toCharArray(); j = 0; k = ac.length; while (j < k) { i = (31 * i) + ac[j]; j++; } return Math.abs(i); } private String change(String s) { byte[] abyte0; char[] ac; int i; int k; int j; abyte0 = s.getBytes(); ac = new char[s.length()]; i = 0; k = abyte0.length; while (i < k) { j = abyte0[i]; if ((j >= 48) && (j <= 57)) { j = (((j - 48) + 5) % 10) + 48; } else if ((j >= 65) && (j <= 90)) { j = (((j - 65) + 13) % 26) + 65; } else if ((j >= 97) && (j <= 122)) { j = (((j - 97) + 13) % 26) + 97; } ac[i] = (char) j; i++; } return String.valueOf(ac); } public static void main(String[] args) { try { System.out.println("please input register name:"); BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); String userId = null; userId = reader.readLine(); if (userId == null || "".equals(userId)) { System.out.println("name is null"); System.exit(0); } MyEclipseKeyGen myeclipsegen = new MyEclipseKeyGen(); String res = myeclipsegen.getSerial(userId, "E3MS"); System.out.println("Serial:" + res); reader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } } }
以下摘自百度知道:
大部分注册算法的原理是:软件或者用户自己触发了软件的注册模块-》软件跳转到注册认证模块。-》弹出注册窗口-》用户输入注册名+注册码A,把它们存放在内存中。然后软件的注册码验证部分根据用户输入的注册名生成正确的注册码B并和用户输入的注册码A做对比。如果结果为相同则注册通过,并运行“注册成功”后面的程序分支,比如解除各种软件限制。如果不相同则提示“无效的注册码,请重新输入!”或者“Invalid key!”等等警告。 知道了原理,我们只要用SOFTICE和TRW2000等汇编调试软件去做软件的动态反汇编。来找到软件注册部分的入口(这个过程就不细说了,有兴趣去看看汇编调试和软件破解的资料) 破解: 这时候后如果我们在软件的注册失败的那段代码前面加一个跳转,说得容易理解一点就是:跳过软件注册码验证失败后应该运行的分支,而将它转到注册成功的那个分支上。那么这时候不管你输入的注册码是对是错,都会提示注册成功。直接将它跳到注册通过的那个程序分支上。这是一种破解方式。还有一种就是直接屏蔽注册窗口,这个最简单,在那段窗口代码前面加一个跳转指令。这个适合于那种频繁弹出注册窗口但软件功能并没有限制的注册软件 注册机: 通过反汇编和调试器跟踪来得到软件的注册码验证部分的汇编代码,然后根据它写出来的逆向算法生成的注册程序。就是注册机了 内存注册机: 跟简单了,因为经过上面的步骤,你已经知道的那个软件的注册算法。知道它会在做注册认证的时候将用户输入的注册码和正确的注册码做对比。把正确内存里的注册码取出来就OK了。所以内存注册机的使用方法都是:先开注册机,用注册机载入软件。然后你随便输入一个注册码,按确定。软件会提示注册失败,因为你的注册码是错误的。不过这个时候正确的注册码已经被内存注册机截取到了
另外提供一段代码 如果以上代码不能生成
import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar;
public class MyEclipseKeyGen_Next { public static final void main(String[] args){ String id="ChenXiaoPeng";//用户名 String num="999"; System.out.println(getSerial(id,"100",num,true));//从新生成 } public static String getSerial(String userId, String version, String licenseNum, boolean selected) { Calendar cal = Calendar.getInstance(); cal.add(1, 3); cal.add(6, -1); NumberFormat nf = new DecimalFormat("000"); licenseNum = nf.format(Integer.valueOf(licenseNum)); String verTime = selected ? (new StringBuffer("-")).append( (new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append( "0").toString() : "-1312310"; //年限13年12月31号 String type = "YE3MB-"; String need = (new StringBuffer(String.valueOf(userId.substring(0, 1)))) .append(type).append(version).append(licenseNum) .append(verTime).toString(); String dx = (new StringBuffer(String.valueOf(need))) .append( "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.") .append(userId).toString(); int suf = decode(dx); String code = (new StringBuffer(String.valueOf(need))).append( String.valueOf(suf)).toString(); return change(code); }
private static int decode(String s) { int i = 0; char ac[] = s.toCharArray(); int j = 0; for (int k = ac.length; j < k; j++) i = 31 * i + ac[j];
return Math.abs(i); }
private static String change(String s) { byte abyte0[] = s.getBytes(); char ac[] = new char[s.length()]; int i = 0; for (int k = abyte0.length; i < k; i++) { int j = abyte0[i]; if (j >= 48 && j <= 57) j = ((j - 48) + 5) % 10 + 48; else if (j >= 65 && j <= 90) j = ((j - 65) + 13) % 26 + 65; else if (j >= 97 && j <= 122) j = ((j - 97) + 13) % 26 + 97; ac[i] = (char) j; }
return String.valueOf(ac); } }