sonatype nexus pro 2.13

貌似开源版使用起来问题较多,咱们试用一下pro版看看还有问题不,于是,首先到官网下载最新的pro版,居然是2.13
然后到网上找一下crack教程,找到这一篇授人以渔的帖子:

虽然版本有差异,不过大同小异

一、把日志开启到Trace级别
其实这个有两种方法,第一种呢日志文件太大,不过日志不会漏网,第二种呢能够精确知道输出日志所在的包会比较好一点,毕竟日志文件内容较少
1、
安装时指定了一个work dir,在这个dir中,有这样一个logback的文件,如果没有的话,首先启动一次nexus,然后再停掉。
conf\logback.properties
把其中的这个配置
root.level=INFO
改成 root.level=TRACE
这样就使得绝大部分的日志输出都是在trace级别了,生成的日志文件当然大了
2、
保留

conf\logback.properties的默认值root.level=INFO
修改conf\logback-nexus.xml文件
在前插入下面白字部分,因为按照上面那篇文章的说法,抛异常的类就类似在这样一个包里:org.sonatype.licensing

点击(此处)折叠或打开

二、然后删除work dir中的logs、tmp两个目录下的文件和文件夹(其实这不不是必须的,是为了弄干净一点,下面方便查看)
接着启动nexus,启动成功后,打开logs下面的nexus.log日志文件,果然发现抛异常了

点击(此处)折叠或打开

  1. 2016-07-19 16:26:57,505+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (1) param=org.sonatype.licensing.trial.TrialLicenseParam@f62d01
  2. 2016-07-19 16:26:57,505+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (2) key=com.sonatype.nexus.licensing.NexusLicenseKey@49e2b
  3. 2016-07-19 16:26:57,511+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense
  4. de.schlichtherle.license.NoLicenseInstalledException: Nexus
  5. at codeguard.licensing.chr.itm(Unknown Source) ~[license-bundle-1.4.jar:1.4]
  6. at codeguard.licensing.xjx.omj(Unknown Source) ~[license-bundle-1.4.jar:1.4]
  7. at codeguard.licensing.xjx.itm(Unknown Source) ~[license-bundle-1.4.jar:1.4]
  8. at codeguard.licensing.bab.mif(Unknown Source) ~[license-bundle-1.4.jar:1.4]
  9. at org**.sonatype.licensing.trial.internal.**DefaultTrialLicenseManager.verifyLicense(Unknown Source) [license-bundle-1.4%20-%20副本.jar:1.4]

于是定位到抛异常的jar包和类以及方法
jar包:**license-bundle-1.4.jar (在这里:nexus pro安装目录下的nexus\WEB-INF\lib)
org.sonatype.licensing.trial.internal.**DefaultTrialLicenseManager
方法:verifyLicense

我们发现,之前那篇文章提到的 DefaultLicenseManager类已经过期了,新版使用了新的类,于是就按照文章的方法来破解吧

三、笨办法破解:
首先建立一个简单java工程,
把nexus pro安装目录下的nexus\WEB-INF\lib文件中的jar包都放到build path中,
对了,还有这个包也加进去slf4j-api-1.7.6.jar,因为要修改的这个类要写日志的嘛,这个包在安装目录的lib目录下
然后,使用jd-gui反编译这个class文件:license-bundle-1.4.jar\org\sonatype\licensing\trial\internal\DefaultTrialLicenseManager.class
反编译后,在我们的java工程里按照这个新建一个java源文件 org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager

四、接下来就简单了:
1、在该类中新建一个方法,人懒,直接把上面文章中的代码copy过来了
尼玛,怎么代码插不进来了!!

中间加了几句日志,主要是来看看破解的效果,是否执行了这段代码。
public void verifyLicense(LicenseKey key){

boolean bool = this.wab.isTraceEnabled();
if (bool) {
this.wab.trace(“verifyLicense (1) param={}”, key);
}

this.wab.info(“=====================================crack=========================================”);
this.wab.info(“=====================================crack=========================================”);
this.wab.info(“=====================================crack=========================================”);
this.wab.info(“=====================================crack=========================================”);
this.wab.info(“=====================================crack=========================================”);

key.setContactName(“zoakerc”);
key.setContactCompany(“”);
key.setContactEmailAddress(“zoakerc@gmail.com“);
key.setContactTelephone(“11011001110”);
key.setContactCountry(“China”);
key.setEvaluation(false);
key.setExpirationDate(new Date(2028 - 1900, 1, 1));
key.setEffectiveDate(new Date(2015 - 1900, 1, 1));
FeatureSet fs = new FeatureSet();
fs.addFeature(new NexusProfessionalFeature());
key.setFeatureSet(fs);
}

2、简单起见,把该类中的另外两个verifyLicense方法的try…catch语句都注释掉,加上我们新的方法调用,类似这样
尼玛,代码死活插不进来!!!

public LicenseKey verifyLicense(TrialLicenseParam paramTrialLicenseParam) throws LicensingException {
boolean bool = this.wab.isTraceEnabled();
if (bool) {
this.wab.trace(“verifyLicense (1) param={}”, paramTrialLicenseParam);
}
LicenseKey localLicenseKey = (LicenseKey) this.bzt.get();
if (bool) {
this.wab.trace(“verifyLicense (2) key={}”, localLicenseKey);
}
verifyLicense(localLicenseKey);
// try {
// CustomLicenseContent localCustomLicenseContent = (CustomLicenseContent) new xjx(paramTrialLicenseParam,
// this.bwp).mif();
// if (bool) {
// this.wab.trace(“verifyLicense (3) content={}”, localCustomLicenseContent);
// }
// localLicenseKey.populateFromLicenseContent(localCustomLicenseContent);
// } catch (LicenseContentException localLicenseContentException) {
// if (bool) {
// this.wab.trace(“verifyLicense”, localLicenseContentException);
// }
// throw itm(localLicenseKey, localLicenseContentException);
// } catch (Exception localException) {
// if (bool) {
// this.wab.trace(“verifyLicense”, localException);
// }
// throw new LicensingException(“Unable to verify license: “ + itm(localException), localException);
// }
// if (bool) {
// this.wab.trace(“verifyLicense (4) key={}”, localLicenseKey);
// }
return localLicenseKey;
}

public LicenseKey verifyLicense(TrialLicenseParam paramTrialLicenseParam, File paramFile)
throws LicensingException {
boolean bool = this.wab.isTraceEnabled();
if (bool) {
this.wab.trace(“verifyLicense (1) param={},file={}”, paramTrialLicenseParam, paramFile);
}
LicenseKey localLicenseKey = (LicenseKey) this.bzt.get();
if (bool) {
this.wab.trace(“verifyLicense (2) key={}”, localLicenseKey);
}
verifyLicense(localLicenseKey);
// try {
// CustomLicenseContent localCustomLicenseContent = new xjx(paramTrialLicenseParam, this.bwp).rkn(paramFile);
// localLicenseKey.populateFromLicenseContent(localCustomLicenseContent);
// } catch (LicenseContentException localLicenseContentException) {
// if (bool) {
// this.wab.trace(“verifyLicense”, localLicenseContentException);
// }
// throw itm(localLicenseKey, localLicenseContentException);
// } catch (Exception localException) {
// if (bool) {
// this.wab.trace(“verifyLicense”, localException);
// }
// throw new LicensingException(“Unable to verify license”, localException);
// }
return localLicenseKey;
}

3、搞定收工,然后找到这个源文件编译后的class文件,替换到license-bundle-1.4.jar这个jar包中,替换之前,记得停掉nexus,否则使用中替换不了。
不放心的话,先把这个jar包备份一下,记得备份的时候,把备份的文件移到其他地方去,或者把备份的文件的后缀名改掉,不要以jar开头,否则可能到时候加载的时候还是加载了原先的jar包

4、再次清空work dir中的logs、tmp两个文件夹(为了干净嘛)
然后start nexus
启动完成后,查看nexus.log文件
尼玛,怎么又能插入代码了!!
看到我们加的日志crack已经打印出来,貌似还说验证通过了,窃喜一下。

点击(此处)折叠或打开

  1. 2016-07-19 16:32:51,716+0800 DEBUG [jetty-main-1] *SYSTEM org.sonatype.licensing.product.internal.PeriodicLicenseValidatorImpl - Starting
  2. 2016-07-19 16:32:51,716+0800 DEBUG [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.PeriodicLicenseValidatorImpl - Validating
  3. 2016-07-19 16:32:51,717+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (1) param=org.sonatype.licensing.trial.TrialLicenseParam@c640e6
  4. 2016-07-19 16:32:51,717+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (2) key=com.sonatype.nexus.licensing.NexusLicenseKey@4ca73b
  5. 2016-07-19 16:32:51,717+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (1) param=com.sonatype.nexus.licensing.NexusLicenseKey@4ca73b
  6. 2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  7. 2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  8. 2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  9. 2016-07-19 16:32:51,718+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  10. 2016-07-19 16:32:51,718+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  11. 2016-07-19 16:32:51,718+0800 DEBUG [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.LicenseChangeNotifierImpl - License valid
  12. 2016-07-19 16:32:51,718+0800 DEBUG [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.DefaultLicenseFeatureVerifier - Update state: key=com.sonatype.nexus.licensing.NexusLicenseKey@4ca73b, valid=true
  13. 2016-07-19 16:32:51,721+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.LicenseChangeNotifierImpl - Notifying listener: com.sonatype.nexus.licensing.NexusLicenseChangeListener@1c791be
  14. 2016-07-19 16:32:51,721+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM com.sonatype.nexus.licensing.NexusLicenseChangeListener - License changed; valid: true
  15. 2016-07-19 16:32:51,722+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (1) param=org.sonatype.licensing.trial.TrialLicenseParam@bbe678
  16. 2016-07-19 16:32:51,722+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (2) key=com.sonatype.nexus.licensing.NexusLicenseKey@14cb584
  17. 2016-07-19 16:32:51,722+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense (1) param=com.sonatype.nexus.licensing.NexusLicenseKey@14cb584
  18. 2016-07-19 16:32:51,722+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  19. 2016-07-19 16:32:51,722+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
  20. 2016-07-19 16:32:51,722+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====

我日,怎么出去到代码外面编辑呀?

5、赶快验证一下吧
进入nexus页面 因为之前玩开源版占用了8081,这次安装使用的端口是9091
发现已经进到页面里面了,不需要填写什么姓、名这些注册信息了。
然后登录之:登录 admin/admin123, 左边菜单树点击 Administration - Licensing ,看到的画面看起来破解成功了,先用几天再看看吧。

Nexus 3.x (Spring Boot Single Jar) 修改与破解标准操作文档

本文档适用于 Nexus Repository Manager 3.x 版本(特别是 3.88+),采用 Spring Boot 可执行 Jar 包(Single Jar Distribution)部署的情况。

1. 核心原理

  • 结构: 新版 Nexus 是一个巨大的 Spring Boot 可执行 Jar (sonatype-nexus-repository-*.jar),所有依赖包都嵌套在内部的 BOOT-INF/lib 目录下。
  • 限制: Spring Boot 的类加载器要求嵌套的 Jar 包必须以 STORED (无压缩/0%压缩) 方式存储。使用 WinRAR/7-Zip 默认压缩会导致 BeanDefinitionStoreException: I/O failure
  • 校验: nexus-licensing-extension 包以此方式修改后,不需要通过复杂的 OSGi 签名校验,但必须清理自身的 META-INF 签名文件。

2. 准备工作

  • 工具: JDK (建议 JDK 21 或与 Nexus 运行时一致), 命令行终端 (CMD/PowerShell), 压缩软件 (WinRAR/Bandizip)。
  • 路径: 假设 Nexus 安装/解压在 F:\nexus-3.88.0
  • 目标文件: 主程序位于 bin\sonatype-nexus-repository-3.88.0-08.jar

3. 详细步骤

第一步:提取目标 Jar 包

不要直接解压整个几百兆的主程序,只需提取你需要修改的那个包。

  1. 使用压缩软件打开 bin\sonatype-nexus-repository-3.88.0-08.jar
  2. 进入 BOOT-INF\lib 目录。
  3. 找到 nexus-licensing-extension-3.88.0-08.jar,将其拖出来放到你的工作目录(例如 F:\work)。

第二步:修改与编译代码

假设你要修改 com.sonatype.nexus.licensing.ext.AbstractNexusFeature 或其他类。

  1. 提取依赖: 为了通过编译,你需要依赖包。建议把 sonatype-nexus-repository-*.jarBOOT-INF/lib 下的所有 jar 解压到一个库目录(例如 F:\libs)。

  2. 编写/修改代码: 确保包名结构正确(例如 com\sonatype\nexus\...)。

  3. 编译命令:

    1
    javac -cp ".;F:\libs\*" -d classes src\com\sonatype\nexus\licensing\ext\YourFile.java
  4. 替换 Class: 将编译生成的 .class 文件覆盖到 nexus-licensing-extension-3.88.0-08.jar 对应的目录中。

第三步:清理签名 (关键)

为了防止 SecurityException,必须移除修改过的 Jar 包的旧签名。

  1. 用压缩软件打开 nexus-licensing-extension-3.88.0-08.jar
  2. 进入 META-INF 目录。
  3. 删除 所有后缀为 .SF, .RSA, .DSA 的文件。
  4. 修改 MANIFEST.MF 文件 (这一步至关重要):
    • 用文本编辑器打开它。
    • 删除所有包含 SHA-256-Digest: 的行(以及其上方的 Name: 行)。
    • 只保留 头部基本信息 (Manifest-Version, Implementation-Version 等)。

第四步:无压缩植入 (最关键)

必须使用 JDK 自带的 jar 命令以 0 (Stored) 模式将修改后的包放回主程序。严禁使用 WinRAR 直接拖回。

  1. 在工作目录(存放修改后 jar 的地方)创建对应的目录结构。

    1
    2
    3
    mkdir BOOT-INF\lib

    copy nexus-licensing-extension-3.88.0-08.jar BOOT-INF\lib\
  2. 执行植入命令:

    1
    jar -u0f "F:\nexus-3.88.0\bin\sonatype-nexus-repository-3.88.0-08.jar" BOOT-INF\lib\nexus-licensing-extension-3.88.0-08.jar
    • -u: 更新 (update)
    • -0: 无压缩 (store) —— 这一步错了就会导致 I/O failure
    • -f: 指定文件

第五步:清理缓存并启动

  1. 删除运行数据中的缓存目录:
    • <WorkDir>\sonatype-work\nexus3\cache
    • <WorkDir>\sonatype-work\nexus3\tmp
  2. 启动 Nexus。

4. 常见报错排查

报错信息 原因 解决方法
BeanDefinitionStoreException: I/O failure 嵌套 Jar 被压缩了 重新执行第四步,确保使用了 -u0f 参数。
SecurityException: SHA-256 digest error 只删了 .SF 文件但没改 MANIFEST.MF 重新执行第三步,清理 MANIFEST.MF 中的摘要信息。
NoClassDefFoundError 缓存未清理 删除 sonatype-work/nexus3/cache 目录后重启。
UnsupportedClassVersionError 编译用的 JDK 版本过高 使用与 Nexus 运行时一致的 JDK (通常是 JDK 8, 11 或 21)。
评论

:D 一言句子获取中...