本文整理匯總了Python中_winreg.HKEY_USERS屬性的典型用法代碼示例。如果您正苦於以下問題:Python _winreg.HKEY_USERS屬性的具體用法?Python _winreg.HKEY_USERS怎麽用?Python _winreg.HKEY_USERS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類_winreg
的用法示例。
在下文中一共展示了_winreg.HKEY_USERS屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _user_hive
# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import HKEY_USERS [as 別名]
def _user_hive(username=None):
"""Find the registry hive for a particular user."""
hive_base = None
sids = _user_sids()
if username and username in sids:
sid = sids[username]
root_key = winreg.HKEY_USERS
try:
hive_reg = winreg.OpenKey(root_key, sid, 0, READ_ACCESS)
if hive_reg:
hive_base = sid
except:
pass
return hive_base
示例2: getUserRegistry
# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import HKEY_USERS [as 別名]
def getUserRegistry(computerName,objRegistry,hostPath,tmpIndicators,registryList):
print computerName + " - checking user Registry"
for hive,username,userpath in registryList:
if hive == _winreg.HKEY_LOCAL_MACHINE:
print computerName + " - user Registry: checking logged out user (" + username + ")..."
elif hive == _winreg.HKEY_USERS:
print computerName + " - user Registry: checking logged in user (" + username + ")..."
pollReg(computerName,hostPath,username,hive,userpath,objRegistry,tmpIndicators)
示例3: getLoginStatus
# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import HKEY_USERS [as 別名]
def getLoginStatus(profile_path,profileSID,username,objRegistry):
result,subkeys = objRegistry.EnumKey(hDefKey=_winreg.HKEY_USERS,sSubKeyName=profileSID)
if result == 0:
return [_winreg.HKEY_USERS,profileSID]
else:
return [_winreg.HKEY_LOCAL_MACHINE,username]
#works with the common types of registry keys
示例4: getShellbags
# 需要導入模塊: import _winreg [as 別名]
# 或者: from _winreg import HKEY_USERS [as 別名]
def getShellbags(computerName,objRegistry,hostPath,registryList):
print computerName + " - checking shellbags"
userpath2 = ""
for hive,username,userpath in registryList:
outFile = open(hostPath + "\SHELLBAGS-" + username + "-" + computerName + ".csv", "w")
outFile.write("path,created,modified,accessed\n")
if hive == _winreg.HKEY_LOCAL_MACHINE:
print computerName + " - shellbags: checking logged out user (" + username + ")..."
userpath2 = userpath + "2"
elif hive == _winreg.HKEY_USERS:
print computerName + " - shellbags: checking logged in user (" + username + ")..."
userpath2 = userpath + "\Software\Classes"
keys = [userpath + "\Software\Microsoft\Windows\Shell", userpath + "\Software\Microsoft\Windows\ShellNoRoam",
userpath2 + "\Local Settings\Software\Microsoft\Windows\Shell", userpath2 + "\Local Settings\Software\Microsoft\Windows\ShellNoRoam"]
shellbags = []
for key in keys:
new_shellbags = get_shellbags(objRegistry,hive,key)
shellbags.extend(new_shellbags)
for shellbag in shellbags:
outFile.write(support.convert_to_string(shellbag["path"]).replace(","," ") + "," + support.convert_to_string(shellbag["crtime"]) + "," +
support.convert_to_string(shellbag["mtime"]) + "," + support.convert_to_string(shellbag["atime"]) + "\n")
outFile.close()