貌似开源版使用起来问题较多,咱们试用一下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
-
<logger name="org.sonatype.licensing" level="trace" additivity="false">
-
<appender-ref ref="console" />
-
<appender-ref ref="logfile" />
-
<appender-ref ref="metrics" />
-
</logger>
-
-
<root level="${root.level}">
-
<appender-ref ref="console"/>
-
<appender-ref ref="logfile"/>
-
<appender-ref ref="metrics"/>
-
</root>
二、然后删除work dir中的logs、tmp两个目录下的文件和文件夹(其实这不不是必须的,是为了弄干净一点,下面方便查看)
接着启动nexus,启动成功后,打开logs下面的nexus.log日志文件,果然发现抛异常了
-
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
-
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
-
2016-07-19 16:26:57,511+0800 TRACE [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - verifyLicense
-
de.schlichtherle.license.NoLicenseInstalledException: Nexus
-
at codeguard.licensing.chr.itm(Unknown Source) ~[license-bundle-1.4.jar:1.4]
-
at codeguard.licensing.xjx.omj(Unknown Source) ~[license-bundle-1.4.jar:1.4]
-
at codeguard.licensing.xjx.itm(Unknown Source) ~[license-bundle-1.4.jar:1.4]
-
at codeguard.licensing.bab.mif(Unknown Source) ~[license-bundle-1.4.jar:1.4]
-
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已经打印出来,貌似还说验证通过了,窃喜一下。
-
2016-07-19 16:32:51,716+0800 DEBUG [jetty-main-1] *SYSTEM org.sonatype.licensing.product.internal.PeriodicLicenseValidatorImpl - Starting
-
2016-07-19 16:32:51,716+0800 DEBUG [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.PeriodicLicenseValidatorImpl - Validating
-
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
-
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
-
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
-
2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,717+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,718+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,718+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,718+0800 DEBUG [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.product.internal.LicenseChangeNotifierImpl - License valid
-
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
-
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
-
2016-07-19 16:32:51,721+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM com.sonatype.nexus.licensing.NexusLicenseChangeListener - License changed; valid: true
-
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
-
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
-
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
-
2016-07-19 16:32:51,722+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
2016-07-19 16:32:51,722+0800 INFO [PeriodicLicenseValidatorImpl-timer] *SYSTEM org.sonatype.licensing.trial.internal.DefaultTrialLicenseManager - =====================================crack=========================================
-
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 ,看到的画面看起来破解成功了,先用几天再看看吧。
本来我还想把修改过的java源文件和class文件放上来,貌似没有上床功能?
阅读(7177) | 评论(0) | 转发(0) |