WingIDE-keygen.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @Author : liuyuqi
  5. @Contact : liuyuqi.gov@msn.cn
  6. @Time : 2019/11/25 19:55:56
  7. @Version : 1.0
  8. @License : (C)Copyright 2019
  9. @Desc : None
  10. '''
  11. LicenseID = 'CN123-12345-12345-12345'
  12. RequestCode = 'RW634-RPMLN-Q8FKG-MXPT7'
  13. B16 = '0123456789ABCDEF'
  14. B30 = '123456789ABCDEFGHJKLMNPQRTVWXY'
  15. import hashlib
  16. def B(n, f, t):
  17. xx = 0
  18. for d in str(n):
  19. xx = xx * len(f) + f.index(d)
  20. res = ''
  21. while xx > 0:
  22. res = t[int(xx % len(t))] + res
  23. xx //= len(t)
  24. return res
  25. def S(D):
  26. r = B(''.join([c for i, c in enumerate(D) if i // 2 * 2 == i]), B16, B30)
  27. while len(r) < 17:
  28. r = '1' + r
  29. return r
  30. def A(c):
  31. return c[:5] + '-' + c[5:10] + '-' + c[10:15] + '-' + c[15:]
  32. if __name__ == "__main__":
  33. h = hashlib.sha1()
  34. h.update(RequestCode.encode('utf-8') + LicenseID.encode('utf-8'))
  35. lichash = A(RequestCode[:3] + S(h.hexdigest().upper()))
  36. data = [23, 161, 47, 9]
  37. tmp = 0
  38. realcode = ''
  39. for i in data:
  40. for j in lichash:
  41. tmp = (tmp * i + ord(j)) & 0xFFFFF
  42. realcode += format(tmp, '=05X')
  43. tmp = 0
  44. D = B(realcode, B16, B30)
  45. while len(D) < 17:
  46. D = '1' + D
  47. print("The Activation Code is: " + A('AXX' + D))