windowssecurity

package
v0.0.0-...-f1573f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SE_UNKNOWN_OBJECT_TYPE     = 0
	SE_FILE_OBJECT             = 1
	SE_SERVICE                 = 2
	SE_PRINTER                 = 3
	SE_REGISTRY_KEY            = 4
	SE_LMSHARE                 = 5
	SE_KERNEL_OBJECT           = 6
	SE_WINDOW_OBJECT           = 7
	SE_DS_OBJECT               = 8
	SE_DS_OBJECT_ALL           = 9
	SE_PROVIDER_DEFINED_OBJECT = 10
	SE_WMIGUID_OBJECT          = 11
	SE_REGISTRY_WOW64_32KEY    = 12
	SE_REGISTRY_WOW64_64KEY    = 13
)

Constants for type SE_OBJECT_TYPE

Variables

View Source
var (
	KnownSIDs = map[string]string{
		"S-1-0":        "Null Authority",
		"S-1-0-0":      "Nobody",
		"S-1-1":        "World Authority",
		"S-1-1-0":      "Everyone",
		"S-1-16-0":     "Untrusted Mandatory Level",
		"S-1-16-12288": "High Mandatory Level",
		"S-1-16-16384": "System Mandatory Level",
		"S-1-16-20480": "Protected Process Mandatory Level",
		"S-1-16-28672": "Secure Process Mandatory Level",
		"S-1-16-4096":  "Low Mandatory Level",
		"S-1-16-8192":  "Medium Mandatory Level",
		"S-1-16-8448":  "Medium Plus Mandatory Level",
		"S-1-2":        "Local Authority",
		"S-1-2-0":      "Local",
		"S-1-3":        "Creator Authority",
		"S-1-3-0":      "Creator Owner",
		"S-1-3-1":      "Creator Group",
		"S-1-3-2":      "Creator Owner Server",
		"S-1-3-3":      "Creator Group Server",
		"S-1-3-4":      "Owner Rights",
		"S-1-4":        "Non-unique Authority",
		"S-1-5":        "NT Authority",
		"S-1-5-1":      "Dialup",
		"S-1-5-10":     "Principal Self",
		"S-1-5-11":     "Authenticated Users",
		"S-1-5-12":     "Restricted Code",
		"S-1-5-13":     "Terminal Server Users",
		"S-1-5-14":     "Remote Interactive Logon",
		"S-1-5-15":     "This Organization",
		"S-1-5-17":     "IUSR",
		"S-1-5-18":     "Local System",
		"S-1-5-19":     "Local Service",
		"S-1-5-2":      "Network",
		"S-1-5-20":     "Network Service",
		"S-1-5-3":      "Batch",
		"S-1-5-32-544": "Administrators",
		"S-1-5-32-545": "Users",
		"S-1-5-32-546": "Guests",
		"S-1-5-32-547": "Power Users",
		"S-1-5-32-548": "Account Operators",
		"S-1-5-32-549": "Server Operators",
		"S-1-5-32-550": "Print Operators",
		"S-1-5-32-551": "Backup Operators",
		"S-1-5-32-552": "Replicators",
		"S-1-5-32-554": "Builtin - Pre-Windows 2000 Compatible Access",
		"S-1-5-32-555": "Builtin - Remote Desktop Users",
		"S-1-5-32-556": "Builtin - Network Configuration Operators",
		"S-1-5-32-557": "Builtin - Incoming Forest Trust Builders",
		"S-1-5-32-558": "Builtin - Performance Monitor Users",
		"S-1-5-32-559": "Builtin - Performance Log Users",
		"S-1-5-32-560": "Builtin - Windows Authorization Access Group",
		"S-1-5-32-561": "Builtin - Terminal Server License Servers",
		"S-1-5-32-562": "Builtin - Distributed COM Users",
		"S-1-5-32-569": "Builtin - Cryptographic Operators",
		"S-1-5-32-573": "Builtin - Event Log Readers",
		"S-1-5-32-574": "Builtin - Certificate Service DCOM Access",
		"S-1-5-32-575": "Builtin - RDS Remote Access Servers",
		"S-1-5-32-576": "Builtin - RDS Endpoint Servers",
		"S-1-5-32-577": "Builtin - RDS Management Servers",
		"S-1-5-32-578": "Builtin - Hyper-V Administrators",
		"S-1-5-32-579": "Builtin - Access Control Assistance Operators",
		"S-1-5-32-580": "Builtin - Remote Management Users",
		"S-1-5-32-582": "Storage Replica Administrators",
		"S-1-5-4":      "Interactive",

		"S-1-5-6":     "Service",
		"S-1-5-64-10": "NTLM Authentication",
		"S-1-5-64-14": "SChannel Authentication",
		"S-1-5-64-21": "Digest Authentication",
		"S-1-5-7":     "Anonymous",
		"S-1-5-8":     "Proxy",
		"S-1-5-80":    "NT Service",
		"S-1-5-80-0":  "All Services",
		"S-1-5-83-0":  "NT Virtual Machine - Virtual Machines",
		"S-1-5-9":     "Enterprise Domain Controllers",
		"S-1-5-90-0":  "Windows Manager - Windows Manager Group",
	}
	AnonymousLogonSID, _  = ParseStringSID("S-1-5-7")
	GuestsSID, _          = ParseStringSID("S-1-5-32-546")
	BackupOperatorsSID, _ = ParseStringSID("S-1-5-32-551")
	// UsersSID,_=ParseStringSID("")
	CertificateServerAdminsSID, _ = ParseStringSID("")

	AdministratorsSID, _     = ParseStringSID("S-1-5-32-544")
	RemoteDesktopUsersSID, _ = ParseStringSID("S-1-5-32-555")
	DCOMUsersSID, _          = ParseStringSID("S-1-5-32-562")

	OwnerSID, _              = ParseStringSID("S-1-3-4")
	CreatorOwnerSID, _       = ParseStringSID("S-1-3-0")
	CreatorGroupSID, _       = ParseStringSID("S-1-3-1")
	SelfSID, _               = ParseStringSID("S-1-5-10")
	AuthenticatedUsersSID, _ = ParseStringSID("S-1-5-11")
	EveryoneSID, _           = ParseStringSID("S-1-1-0")

	ServicesSID, _ = ParseStringSID("S-1-5-6")

	InteractiveSID, _       = ParseStringSID("S-1-5-4")
	RemoteInteractiveSID, _ = ParseStringSID("S-1-5-14")

	SystemSID, _         = ParseStringSID("S-1-5-18")
	LocalServiceSID, _   = ParseStringSID("S-1-5-19")
	NetworkServiceSID, _ = ParseStringSID("S-1-5-20")

	AccountOperatorsSID, _ = ParseStringSID("S-1-5-32-548")
)
View Source
var ErrorOnlySIDVersion1Supported = errors.New("only SID version 1 supported")

Functions

This section is empty.

Types

type SE_OBJECT_TYPE

type SE_OBJECT_TYPE uint32

type SID

type SID string

func BytesToSID

func BytesToSID(data []byte) (SID, []byte, error)

func GetOwnerAndDACL

func GetOwnerAndDACL(objectName string, objectType SE_OBJECT_TYPE) (SID, []byte, error)

func MustParseStringSID

func MustParseStringSID(input string) SID

func ParseStringSID

func ParseStringSID(input string) (SID, error)

func SIDFromPtr

func SIDFromPtr(data uintptr) (SID, error)

func ServiceNameToServiceSID

func ServiceNameToServiceSID(servicename string) SID

Calculate a Windows service SID by converting servicename to uppercase, converting to Unicode 16, running through SHA1, and then converting to SID

func (SID) AddComponent

func (sid SID) AddComponent(component uint32) SID

func (SID) Component

func (sid SID) Component(n int) uint64

func (SID) Components

func (sid SID) Components() int

func (SID) IsBlank

func (sid SID) IsBlank() bool

func (SID) IsNull

func (sid SID) IsNull() bool

func (SID) MarshalJSON

func (sid SID) MarshalJSON() ([]byte, error)

func (SID) RID

func (sid SID) RID() uint32

func (SID) String

func (sid SID) String() string

func (SID) StripRID

func (sid SID) StripRID() SID

func (*SID) UnmarshalJSON

func (sid *SID) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL