JetBrains dotCover 2.0 破解研究(注册机)

请支持正版

参考

首先在 JetBrains.Dotcover.ShellBase dll中的

DotCoverLicenseSupport中找到public key为:

3127336858484881521162666190662554489729299255697760308701
解出来的private key 为:
3127336858484881521162666190547157926407842811051745897404
使用软件RSATool
image
求出p q,带入公式
(p - 1) * (q - 1)

为私钥

   1: int num = this.UserHash();
   2: BigInteger bigInteger = new BigInteger(65535L);
   3: bigInteger <<= 72;
   4: bigInteger += new BigInteger((long)num);
   5: BigInteger bigInteger2 = new BigInteger(65535L);
   6: bigInteger2 <<= 56;            
   7: bigInteger += bigInteger2;
   8: BigInteger gDate = new BigInteger(2196L);
   9: gDate <<= 40;
  10: bigInteger += gDate;
  11:  
  12: BigInteger n = new BigInteger(PUBLIC_KEY, 10);
  13: BigInteger modulus = new BigInteger(PRIVATE_KEY, 10);
  14: BigInteger bi = new BigInteger(Encoding.Default.GetBytes(UserName));
  15: BigInteger exp = (bi | 1).modInverse(modulus);
  16: return Convert.ToBase64String(bigInteger.modPow(exp, n).getBytes());

以上为主要算法,基本和resharper一样,只是需要一个GenerationDate,BigInterget网上下的。UserHash从他源码中copy的。其他就没什么了

image

GenerationDate分析

在DotConverLicenseSupport构造中发现,如果不做这个Date,生成的sn虽然是通过的,但是他会提示Subscription is valid only for…..

image

   1: DateTime dateTime = data.ContainsSubscription ? data.SubscriptionEndDate : data.GenerationDate.AddYears(1);
   2: if (dateTime.AddDays(1.0) <= productBuildDate)
   3: {
   4:     return new LicenseCheckResult("Subscription is valid only for {0} builds released before {1}", new object[]
   5:     {
   6:         <>c__DisplayClass.descriptor.ProductName,
   7:         dateTime.ToShortDateString()
   8:     });
   9: }
查看productBuildDate为

   1: private static DateTime GetProductBuildDateForTheSubscriptionCheck(IApplicationDescriptor descriptor)
   2: {
   3:     return new DateTime(2012, 6, 18);
   4: }

LicenseCheker类中

   1: public DateTime GenerationDate
   2: {
   3:     get
   4:     {
   5:         return this.GetDateTime(40);
   6:     }
   7: }
   8: private DateTime GetDateTime(int offset)
   9: {
  10:     int num = (this.myCode >> offset).IntValue() & 65535;
  11:     if (num == 65535)
  12:     {
  13:         return DateTime.MaxValue;
  14:     }
  15:     if (num == 0)
  16:     {
  17:         return DateTime.MinValue;
  18:     }
  19:     DateTime result;
  20:     try
  21:     {
  22:         result = new DateTime(2003 + (num & 127), num >> 7 & 15, num >> 11);
  23:     }
  24:     catch (Exception)
  25:     {
  26:         result = DateTime.MinValue;
  27:     }
  28:     return result;
  29: }

关键在这一句

result = new DateTime(2003 + (num & 127), num >> 7 & 15, num >> 11);

这个result的值要大于2012-6-18

如果直接给65535,会返回DateTime.MaxValue,这时在AddYear(1)就报错了。所以要算一个数符合上面这句的规则

>>7是128,>>11是2048 2048+128=2196。

将2196带入,测试通过

网上有很多resharper6的注册机,可参考。

resharper7的public key目前和resharper 6一样,可直接注册。

仅供学习研究,请勿用于商业用途。

BigInteger类

原文地址:https://www.cnblogs.com/czcz1024/p/2637903.html