JIRA(6.x/7.x)与Confluence(6.x)反编译破解方法

以下请仅用于个人学习,商业用途请购买正版。

0 说明

通过反编译class文件,修改获取授权信息的代码实现。

  • 破解JIRA修改以下包中的两个文件:
    • /opt/atlassian/jira/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar
    • com\atlassian\extras\decoder\v2\Version2LicenseDecoder.class
    • com\atlassian\license\LicenseManager.class
  • 破解Confluence修改以下包中的一个文件:
    • /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar
    • com\atlassian\extras\decoder\v2\Version2LicenseDecoder.class
  • 破解JIRA和Confluence全部插件修改一下包中的一个class文件,两个的jar版本不一样:
    • /opt/atlassian/jira/atlassian-jira/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar
    • /opt/atlassian/confluence/confluence/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar
    • com\atlassian\extras\decoder\v2\Version2LicenseDecoder.class

以上路径视Jira和Confluence安装路径不同而分别相应调整/opt/atlassian/jira/opt/atlassian/confluence

1 破解过程

1.1 备份jar包

如果是在docker中部署的话,首先需要把这些jar拷出来,如:

  • JIRA:
先备份原来的jar:
docker cp jira:/opt/atlassian/jira/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar ./backup/
docker cp jira:/opt/atlassian/jira/atlassian-jira/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar ./backup
  • Confluence:
先备份原来的jar:
docker cp confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar ./backup/
docker cp confluence:/opt/atlassian/confluence/confluence/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar ./backup/

1.2 破解

创建一个Java项目,将拷出来的jar包作为lib导入到项目中。使用IDE的话就可以查看jar包中的class文件,比如 IntelliJ IDEA直接打开的话会反编译。

查看四个jar包中的相关class文件的内容,发现,所有包中的Version2LicenseDecoder.class都是一样的。因此只需要破解两个class文件即可:

  • com.atlassian.extras.decoder.v2.Version2LicenseDecoder
  • com.atlassian.license.LicenseManager

src下创建相同的package和java文件,将反编译的内容拷过来,修改的内容如下:

  • Version2LicenseDecoder.java:
// 修改如下用于加载license信息的方法,这是原来的
private Properties loadLicenseConfiguration(Reader text) {
    try {
        Properties props = new Properties();
        (new DefaultPropertiesPersister()).load(props, text);
        return props;
    } catch (IOException var3) {
        throw new LicenseException("Could NOT load properties from reader", var3);
    }
}


// 修改为如下样子,其实就是将加载的license属性替换为“COMMERCIAL”,下边的破解后的class还可以用于Bitbucket和FishEye
private Properties loadLicenseConfiguration(Reader text) {
    Properties props = new Properties();
    try {
        (new DefaultPropertiesPersister()).load(props, text);
        if (props.containsKey("Description")) {
            String desc = props.getProperty("Description");
            props.put("Description",
                    desc.replace("Evaluation", "Commercial"));

            if (desc.contains("Confluence")) {
                props.put("conf.LicenseTypeName", "COMMERCIAL");
            } else if (desc.contains("JIRA")) {
                props.put("jira.LicenseTypeName", "COMMERCIAL");
            } else if (desc.contains("FishEye")) {
                props.put("fisheye.LicenseTypeName", "COMMERCIAL");
            } else if (desc.contains("Bitbucket")) {
                props.put("stash.LicenseTypeName", "COMMERCIAL");
            }

            props.put("Evaluation", false);
            props.put("MaintenanceExpiryDate", "2033-06-06");
            props.put("LicenseExpiryDate", "2033-06-06");
        }
        return props;
    } catch (IOException var3) {
        throw new LicenseException("Could NOT load properties from reader", var3);
    }
}
  • LicenseManager.java
// 修改如下方法:
public boolean hasValidLicense(String licenseKey) {
    return this.getLicense(licenseKey) != null && !this.getLicense(licenseKey).isExpired();
}


// 直接修改为返回true即可
public boolean hasValidLicense(String licenseKey) {
    return true;
}

最后编译两个java,并将得到的class文件塞回jar包覆盖原class即可(留个备份版哟~)。

1.3 生效

将破解后的jar包放回原位,并重启服务即可。

如果是容器部署的话,可以通过类似如下命令拷回:

# JIRA
docker cp cracked/atlassian-extras-3.2.jar jira:/opt/atlassian/jira/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar
docker cp cracked/atlassian-universal-plugin-manager-plugin-2.22.9.jar jira:/opt/atlassian/jira/atlassian-jira/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar


docker restart jira


# Confluence
docker cp atlassian-extras-decoder-v2-3.3.0.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar
docker cp atlassian-universal-plugin-manager-plugin-2.22.9.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-2.22.9.jar


docker restart confluence

附破解好的jar:JIRA、Confluence

你可能感兴趣的:(【持续集成】)