本文整理汇总了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()