get domain controller function

This commit is contained in:
Alessandro ZANNI 2016-10-07 17:54:43 +02:00
parent 5eb38cdf6c
commit 332eba3264
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
from _winreg import *
def get_domain_controller():
aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
keypath = r"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\History\\"
subkey_name = 'DCName'
try:
aKey = OpenKey(aReg, keypath)
val, _ = QueryValueEx(aKey, subkey_name)
CloseKey(aKey)
return val
except:
return False