Documentation ¶
Overview ¶
utility package implements all the shared methods between clients.
utility package implements all the shared methods between clients.
Index ¶
- Constants
- Variables
- func NewListener(log log.T, address string) (net.Listener, error)
- type ISessionUtil
- type SessionUtil
- func (u *SessionUtil) ChangeUserShell() (err error)
- func (u *SessionUtil) CreateLocalAdminUser(log log.T) (newPassword string, err error)
- func (u *SessionUtil) DeleteIpcTempFile(log log.T, sessionOrchestrationPath string) (bool, error)
- func (u *SessionUtil) DisableLocalUser(log log.T) (err error)
- func (u *SessionUtil) DoesUserExist(username string) (bool, error)
- func (u *SessionUtil) GeneratePasswordForDefaultUser() (string, error)
- func (u *SessionUtil) GetAttr(f *os.File) (int32, error)
- func (u *SessionUtil) ResetPasswordIfDefaultUserExists(context context.T) (err error)
- func (u *SessionUtil) SetAttr(f *os.File, attr int32) error
Constants ¶
const ( FS_APPEND_FL = 0x00000020 /* writes to file may only append */ FS_RESET_FL = 0x00000000 /* reset file property */ )
Variables ¶
var ( ShellPluginCommandName = "sh" ShellPluginCommandArgs = []string{"-c"} )
Functions ¶
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 ¶
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 ¶
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