jira的破解

概述

想要破解一个版本的jira,需要两个文件,一个keygen.java文件,一个jar包。

不同版本的jira,可能keygen.java不同,jar包名字也不同。

keygen.java是注册码的算法文件,这个文件中import了一个类:com.atlassian.license.LicensePair。这个类在上述的jar包中声明。

所以我们需要把jar包解压,并把解压后的文件和keygen.java放在一个目录下,这样keygen.java就能找到它要引用的文件了。

 

运行:电脑安装好jdk,配置好环境变量JAVA_HOME,CLASSPATH。

运行javac keygen.java,先编译。再运行java keygen执行,输入用户名以后,注册码就自动生成出来了。

 

两个文件举例:

jar包:atlassian-extras-0.7.19.jar
keygen.java:

import com.atlassian.license.LicensePair;
import java.io.*;
import java.security.KeyFactory;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;

public class keygen
{

public keygen()
{
}


public static void main(String args[])
throws IOException
{
try
{
long l = 267L;
long l1 = System.currentTimeMillis();
long l2 = System.currentTimeMillis();
String s = “”;
System.out.println(”Keygen for JIRA Enterprise Edition.”);
System.out.print(”created by mydaj[ROR].”);
do
{
System.out.print(”\nEnter your organization name: “);
for(int i = System.in.read(); i != 10 && i != 13; i = System.in.read())
= s + (char)i;

}
 while(s == “”);
try
{
PKCS8EncodedKeySpec pkcs8encodedkeyspec = new PKCS8EncodedKeySpec(EncodedPrvKey);
KeyFactory keyfactory = KeyFactory.getInstance(”DSA”, “SUN”);
java.security.PrivateKey privatekey = keyfactory.generatePrivate(pkcs8encodedkeyspec);
String s1 = Long.toString(l, 10);
s1 = s1 + “^^”;
s1 = s1 + Long.toString(l1, 10);
s1 = s1 + “^^”;
s1 = s1 + Long.toString(l2, 10);
s1 = s1 + “^^”;
s1 = s1 + s;
byte abyte0[] = s1.getBytes();
Signature signature = Signature.getInstance(”SHA1withDSA”);
signature.initSign(privatekey);
signature.update(abyte0);
byte abyte1[] = signature.sign();
LicensePair licensepair = null;
try
{
licensepair = new LicensePair(abyte0, abyte1);
}

catch(Exception exception1)
{
exception1.printStackTrace();
}

System.out.println(s1);
System.out.println(”Your license key is: “);
System.out.println(licensepair.toString());
}

catch(Exception exception)
{
exception.printStackTrace();
}

}

catch(IOException ioexception) { }
}


static byte EncodedPrvKey[] = {
48-12617521048-1261,
446742-12272-505641,
48-1261312-127-1270-3127,
83-12729117184182-3374-100,
46-20-28-25-1017-738260-17,
680-613063-128-748138105,
6993643481-58961-11588,
-6-65-59-11-7048-10-53-10185,
108-41-12759-1282952111-14102,
96-73107-10380-91-92-97-97-24,
41231634-6279-69-87-41-2,
-73-5827-85987-25-58-88-90,
21154-5-125-10-45-5930-61,
25384199022-11150-10117,
-13-824397-4142-17-14343,
25-99-47721-572210-105,
9680-113213511-52-78-110-71,
-126-94-21-12411-168828-112,
-127-1270-9-31-96-123-42-10161,
-34-53-68-859254-7287-71121,
-108-81-69-658-22-126-78776,
11617-126103818987-114-70,
-448979-26113716-127-128-76,
732211335-2476402219-73,
-49950-116-56-90-316022122,
-11784124-11540-32-93-823043,
-77-90117-111110-9312711-633,
5398-15-59812213659-52,
-92-15-66-8881-112-119-88-125-33,
-3190-27-976-110-11710294-128,
123853710017659-2-4973,
424222204250-8830125,
-37118-5020-82-6308-36106,
-9-11012410768
}
;

}

 

 

 

 

新版的Jira4.0.1破解过程与其以前的方式有很大的不同,以下是破解过程:

找到{jira_install}/atltssian-jira/WEB-INF/lib目录下的atlassian-extras- 2.2.2.jar,反编译com.atlassian.extras.decoder.v2 包下的Version2LicenseDecoder类,可以看到loadLicenseConfiguration(Reader text)方法,仅分析这个方法是最终decode后加载License的方法,所以可以修改此方法,以明文 的方式改写license信息,这样jira启动时拿到的就是我们所提供的明文信息了。

Java代码
private Properties loadLicenseConfiguration(Reader text)   
  {   
         
    StringBuffer sb = new StringBuffer();   
        sb.append("Description=JIRA\\: COMMERCIAL\n");   
        sb.append("CreationDate=2009-10-25\n");   
    sb.append("ContactName=test@test.test\n");   
    sb.append("jira.LicenseEdition=ENTERPRISE\n");   
    sb.append("ContactEMail=test@test.com\n");   
    sb.append("Evaluation=false\n");   
    sb.append("jira.LicenseTypeName=COMMERCIAL\n");   
    sb.append("jira.active=true\n");   
    sb.append("licenseVersion=2\n");   
    sb.append("MaintenanceExpiryDate=2010-06-01\n");   
    sb.append("Organisation=test\n");   
    sb.append("jira.NumberOfUsers=-1\n");   
    sb.append("ServerID=B6FW-B4KW-J1A3-4DQB\n");   
    sb.append("LicenseID=LID\n");   
    sb.append("LicenseExpiryDate=2010-06-01\n");   
    sb.append("urchaseDate=2009-12-25\n");   
    StringReader reader = new StringReader(sb.toString());   
      
    try  
    {   
      Properties props = new Properties();   
      new DefaultPropertiesPersister().load(props, reader);   
      return props;   
    }   
    catch (IOException e)   
    {   
      throw new LicenseException("Could NOT load properties from reader", e);   

    }   
  }  

private Properties loadLicenseConfiguration(Reader text)
  {
         
        StringBuffer sb = new StringBuffer();
            sb.append("Description=JIRA\\: COMMERCIAL\n");
            sb.append("CreationDate=2009-10-25\n");
        sb.append("ContactName=test@test.test\n");
        sb.append("jira.LicenseEdition=ENTERPRISE\n");
        sb.append("ContactEMail=test@test.com\n");
        sb.append("Evaluation=false\n");
        sb.append("jira.LicenseTypeName=COMMERCIAL\n");
        sb.append("jira.active=true\n");
        sb.append("licenseVersion=2\n");
        sb.append("MaintenanceExpiryDate=2010-06-01\n");
        sb.append("Organisation=test\n");
        sb.append("jira.NumberOfUsers=-1\n");
        sb.append("ServerID=B6FW-B4KW-J1A3-4DQB\n");
        sb.append("LicenseID=LID\n");
        sb.append("LicenseExpiryDate=2010-06-01\n");
        sb.append("urchaseDate=2009-12-25\n");
        StringReader reader = new StringReader(sb.toString());
        
    try
    {
      Properties props = new Properties();
      new DefaultPropertiesPersister().load(props, reader);
      return props;
    }
    catch (IOException e)
    {
      throw new LicenseException("Could NOT load properties from reader", e);
    }
  }
可以看到我们不使用方法的输入值text而改用自己加载的reader来替换以达到目的。

最后将编译好的类替换相关的类后使用jar命令,如:‘jar -cvf atlassian-extras-2.2.2.jar ./’打包为atlassian-extras-2.2.2.jar替换掉{jira_install}/atltssian-jira/WEB-INF /lib目录下的对应包,启动后即可。 

 

 /tx

 

 

 

posted on 2010-05-14 23:10  izumi  阅读(2378)  评论(0)    收藏  举报

导航