user

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name() (string, error)

Name will return the name of the current user.

func SID

func SID(proc ...windows.Handle) (string, error)

SID will return the SID of the user for the process token associated with the provided process handle. If no handle is provided, it defaults to the current process.

func Whoami

func Whoami(proc ...windows.Handle) (string, error)

Whoami will return output that very nearly (if not exactly) matches the "whoami.exe" output. If no process handle is provided, it defaults to the current process.

func WhoamiAll added in v0.15.2

func WhoamiAll(proc ...windows.Handle) (string, error)

WhoamiAll will return output that very nearly (if not exactly) matches the "whoami.exe /all" output. If no process handle is provided, it defaults to the current process.

func WhoamiGroups added in v0.15.2

func WhoamiGroups(proc ...windows.Handle) (string, error)

WhoamiGroups will return output that very nearly (if not exactly) matches the "whoami.exe /groups" output. If no process handle is provided, it defaults to the current process.

func WhoamiPriv added in v0.15.2

func WhoamiPriv(proc ...windows.Handle) (string, error)

WhoamiPriv will return output that very nearly (if not exactly) matches the "whoami.exe /priv" output. If no process handle is provided, it defaults to the current process.

func WhoamiUser added in v0.15.2

func WhoamiUser(proc ...windows.Handle) (string, error)

WhoamiUser will return output that very nearly (if not exactly) matches the "whoami.exe /user" output. If no process handle is provided, it defaults to the current process.

Types

type Group

type Group struct {
	Attrs []string
	Name  string
	SID   string
	Type  string
}

Group contains information about a Windows group.

func Groups

func Groups(proc ...windows.Handle) ([]Group, error)

Groups returns an array of Groups for the process token associated with the provided process handle. If no handle is provided, it defaults to the current process.

type ID

type ID struct {
	Groups     []Group
	Name       string
	Privileges []*Privilege
	SID        string
}

ID contains information about a Windows user.

func Identity

func Identity(proc ...windows.Handle) (*ID, error)

Identity will return a pointer to a new ID instance containing the user information for the process token associated with the provided process handle. If no handle is provided, it defaults to the current process.

func (*ID) HasPrivilege added in v0.15.1

func (id *ID) HasPrivilege(name string) (*Privilege, bool)

HasPrivilege will search the associated Privileges for one with the provided name. The returned bool should be checked before using the returned Privilege.

func (*ID) InGroup added in v0.15.1

func (id *ID) InGroup(name string) (Group, bool)

InGroup will search the associated Groups for one with the provided name. The returned bool should be checked before using the returned Group.

func (*ID) Whoami added in v0.15.2

func (id *ID) Whoami() string

Whoami will return output that very nearly (if not exactly) matches the "whoami.exe" output.

func (*ID) WhoamiAll added in v0.15.2

func (id *ID) WhoamiAll() string

WhoamiAll will return output that very nearly (if not exactly) matches the "whoami.exe /all" output.

func (*ID) WhoamiGroups added in v0.15.2

func (id *ID) WhoamiGroups() string

WhoamiGroups will return output that very nearly (if not exactly) matches the "whoami.exe /groups" output.

func (*ID) WhoamiPriv added in v0.15.2

func (id *ID) WhoamiPriv() string

WhoamiPriv will return output that very nearly (if not exactly) matches the "whoami.exe /priv" output.

func (*ID) WhoamiUser added in v0.15.2

func (id *ID) WhoamiUser() string

WhoamiUser will return output that very nearly (if not exactly) matches the "whoami.exe /user" output.

type Privilege added in v0.14.0

type Privilege struct {
	Attributes  uint32
	Description string
	LUID        windows.LUID
	Name        string
	// contains filtered or unexported fields
}

Privilege contains information about a Windows privilege.

func Privileges added in v0.14.0

func Privileges(proc ...windows.Handle) ([]*Privilege, error)

Privileges returns an array of Privileges for the process token associated with the provided process handle. If no handle is provided, it defaults to the current process.

func (*Privilege) Disable added in v0.15.2

func (p *Privilege) Disable() error

Disable will adjust token privileges to disable the Privilege.

func (*Privilege) Enable added in v0.15.2

func (p *Privilege) Enable() error

Enable will adjust token privileges to enable the Privilege.

func (*Privilege) Enabled added in v0.15.0

func (p *Privilege) Enabled() bool

Enabled will return whether or not the Privilege has been enabled.

func (*Privilege) EnabledByDefault added in v0.15.0

func (p *Privilege) EnabledByDefault() bool

EnabledByDefault will return whether or not the Privilege is enabled by default.

func (*Privilege) Remove added in v0.19.0

func (p *Privilege) Remove() error

Remove will adjust token privileges to remove the Privilege.

func (*Privilege) Removed added in v0.15.0

func (p *Privilege) Removed() bool

Removed will return whether or not the Privilege has been removed.

func (*Privilege) UsedForAccess added in v0.15.0

func (p *Privilege) UsedForAccess() bool

UsedForAccess will return whether or not the Privilege is used for access.

Jump to

Keyboard shortcuts

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