以下请仅用于个人学习,商业用途请购买正版。
通过反编译class文件,修改获取授权信息的代码实现。
以上路径视Jira和Confluence安装路径不同而分别相应调整/opt/atlassian/jira
和/opt/atlassian/confluence
。
如果是在docker中部署的话,首先需要把这些jar拷出来,如:
先备份原来的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
先备份原来的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/
创建一个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文件,将反编译的内容拷过来,修改的内容如下:
// 修改如下用于加载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);
}
}
// 修改如下方法:
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即可(留个备份版哟~)。
将破解后的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