utility

package
v0.0.0-...-1696013 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Overview

utility package implements all the shared methods between clients.

utility package implements all the shared methods between clients.

Index

Constants

View Source
const (
	FS_APPEND_FL = 0x00000020 /* writes to file may only append */
	FS_RESET_FL  = 0x00000000 /* reset file property */

)

Variables

View Source
var (
	ShellPluginCommandName = "sh"
	ShellPluginCommandArgs = []string{"-c"}
)

Functions

func NewListener

func NewListener(log log.T, address string) (net.Listener, error)

NewListener starts a new socket listener on the address.

Types

type ISessionUtil

type ISessionUtil interface {
	GeneratePasswordForDefaultUser() (string, error)
	ChangePassword(username string, password string) (userExists bool, err error)
	ResetPasswordIfDefaultUserExists(context context.T) (err error)
	AddNewUser(username string, password string) (userExists bool, err error)
	AddUserToLocalAdministratorsGroup(username string) (adminGroupName string, err error)
	IsInstanceADomainController(log log.T) (isDCServiceRunning bool)
	CreateLocalAdminUser(log log.T) (string, error)
	EnableLocalUser(log log.T) error
	DisableLocalUser(log log.T) error
}

type SessionUtil

type SessionUtil struct {
	MinPasswordLength int
	MaxPasswordLength int
}

func (*SessionUtil) ChangeUserShell

func (u *SessionUtil) ChangeUserShell() (err error)

ChangeUserShell changes userShell for DefaultRunAsUser.

func (*SessionUtil) CreateLocalAdminUser

func (u *SessionUtil) CreateLocalAdminUser(log log.T) (newPassword string, err error)

CreateLocalAdminUser creates a local OS user on the instance with admin permissions. The password will alway be empty

func (*SessionUtil) DeleteIpcTempFile

func (u *SessionUtil) DeleteIpcTempFile(log log.T, sessionOrchestrationPath string) (bool, error)

DeleteIpcTempFile resets file properties of ipcTempFile and tries deletion

func (*SessionUtil) DisableLocalUser

func (u *SessionUtil) DisableLocalUser(log log.T) (err error)

func (*SessionUtil) DoesUserExist

func (u *SessionUtil) DoesUserExist(username string) (bool, error)

DoesUserExist checks if given user already exists

func (*SessionUtil) GeneratePasswordForDefaultUser

func (u *SessionUtil) GeneratePasswordForDefaultUser() (string, error)

GeneratePasswordForDefaultUser generates a random password using go lang crypto rand package. Public docs: https://golang.org/pkg/crypto/rand/ On Windows systems, it uses the CryptGenRandom API.

func (*SessionUtil) GetAttr

func (u *SessionUtil) GetAttr(f *os.File) (int32, error)

GetAttr retrieves the attributes of a file on a linux filesystem

func (*SessionUtil) ResetPasswordIfDefaultUserExists

func (u *SessionUtil) ResetPasswordIfDefaultUserExists(context context.T) (err error)

ResetPasswordIfDefaultUserExists resets default RunAs user password if user exists

func (*SessionUtil) SetAttr

func (u *SessionUtil) SetAttr(f *os.File, attr int32) error

SetAttr sets the attributes of a file on a linux filesystem to the given value

Directories

Path Synopsis
Package model contains data objects for session utility
Package model contains data objects for session utility

Jump to

Keyboard shortcuts

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