Skip to content

Instantly share code, notes, and snippets.

@Hispar
Created August 5, 2019 16:34
Show Gist options
  • Save Hispar/84d0eb38e9a86ed207fd54ee51e03e0d to your computer and use it in GitHub Desktop.
Save Hispar/84d0eb38e9a86ed207fd54ee51e03e0d to your computer and use it in GitHub Desktop.
Find DOW keys in windows registry
from winreg import HKEY_CURRENT_USER, ConnectRegistry, OpenKey, EnumKey, QueryValueEx
aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
aKey = OpenKey(aReg, "Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\THQ")
f = open("dow_keys.txt", "a")
for i in range(1024):
try:
keyname = EnumKey(aKey, i)
asubkey = OpenKey(aKey, keyname)
try:
dow_key = QueryValueEx(asubkey, "W40KCDKEY")
f.write(f'Down of war: {dow_key}\n')
except WindowsError:
pass
try:
dow_key2 = QueryValueEx(asubkey, "DXP2CDKEY")
f.write(f'Down of war Dark Crusade: {dow_key2}\n')
except WindowsError:
pass
except WindowsError:
break
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment