Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import os, math, cpuinfo, sys, subprocess, webbrowser
  2. from psutil import virtual_memory
  3.  
  4. windowsKey = "N/A"
  5. cpuBrand = "N/A"
  6. memTotal = "0"
  7.  
  8. def get_windows_license():
  9. global windowsKey
  10. windows_key = subprocess.check_output(['wmic', 'path', 'softwarelicensingservice','get','OA3xOriginalProductKey'])
  11. windows_key = windows_key.decode().split('\r\r\n')
  12. windowsKey=windows_key[1]
  13.  
  14. def get_cpu_info():
  15. cpu = cpuinfo.get_cpu_info()
  16. global cpuBrand
  17. cpuBrand = cpu["brand"]
  18.  
  19. def get_mem_total():
  20. mem = virtual_memory()
  21. global memTotal
  22. memTotal = math.ceil(math.ceil(mem.total / 1024 / 1024) / 1024)
  23. if __name__ == '__main__':
  24. get_windows_license()
  25. get_cpu_info()
  26. get_mem_total()
  27. print("License: " + windowsKey)
  28. print("CPU: " + cpuBrand)
  29. print("Memory: " + str(memTotal) + " GB")
  30.  
  31. URL='http://192.168.88.10/label/printLabel.php?customerName=Key: ' + windowsKey + "&title=" + cpuBrand + "&description=Memory:" + str(memTotal) + ' GB'
  32. webbrowser.open(URL)
  33. sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement