當前位置: 首頁>>代碼示例>>Python>>正文


Python _winreg.HKEY_USERS屬性代碼示例

本文整理匯總了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 
開發者ID:R-ArcGIS,項目名稱:r-bridge-install,代碼行數:16,代碼來源:rpath.py

示例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) 
開發者ID:CIS-CERT,項目名稱:CIS-ESP,代碼行數:11,代碼來源:userRegistry.py

示例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 
開發者ID:CIS-CERT,項目名稱:CIS-ESP,代碼行數:10,代碼來源:support.py

示例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() 
開發者ID:CIS-CERT,項目名稱:CIS-ESP,代碼行數:30,代碼來源:shellbags.py


注:本文中的_winreg.HKEY_USERS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。