make_code.py 638 B

1234567891011121314151617181920212223
  1. """
  2. @File : make_code.py.py
  3. @Author: lee
  4. @Date : 2022/4/7/0007 16:51:10
  5. @Desc :
  6. """
  7. import wmi
  8. from AES_crypt import encrypt
  9. cpu_code = None
  10. code_file_name = "activate_code.txt"
  11. for cpu in wmi.WMI().Win32_Processor():
  12. cpu_code = cpu.ProcessorId.strip()
  13. if cpu_code is not None:
  14. activate_code = encrypt(cpu_code)
  15. fo = open(code_file_name, "w")
  16. fo.write(f"activate code: {activate_code}")
  17. # 关闭打开的文件
  18. fo.close()
  19. print("CPU序列号为:", activate_code, ", 已存储到文件:", code_file_name)
  20. temps = input("按任意键关闭窗口。\n")
  21. else:
  22. print('获取CPU序列号失败!')