powershell

package module
v0.0.0-...-44fb8e3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	// contains filtered or unexported fields
}

Cmd holds information for creating a command to be run in powershell

type Credential

type Credential struct {
	// contains filtered or unexported fields
}

Credential holds the id and username for a PSCredential

func (*Credential) ID

func (c *Credential) ID() string

ID of the credential

func (*Credential) Username

func (c *Credential) Username() string

Username of the credential

type Option

type Option interface {
	Apply(*internal.Settings)
}

func UseHostName

func UseHostName() Option

func WithAllowRedirection

func WithAllowRedirection() Option

func WithAuthentication

func WithAuthentication(auth string) Option

func WithCertificateThumbprint

func WithCertificateThumbprint(thumbprint string) Option

func WithNetworkAccess

func WithNetworkAccess() Option

func WithPort

func WithPort(port int) Option

func WithSSL

func WithSSL() Option

func WithUsernamePassword

func WithUsernamePassword(username, password string) Option

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a remote-session

func (*Session) Close

func (s *Session) Close() error

Close will disconnect from the powershell-session

func (*Session) Execute

func (s *Session) Execute(cmd string) ([]byte, error)

Execute a command in the current session

func (*Session) GetPid

func (s *Session) GetPid() int

GetPid returns the process id of the sessions powershell-process

func (*Session) ID

func (s *Session) ID() string

ID returns the session id

func (*Session) SetCredential

func (s *Session) SetCredential(cred *Credential)

SetCredential sets a specific credential which will be used to run commands within the session

type Shell

type Shell struct {
	// contains filtered or unexported fields
}

Shell holds the underlying powershell-process and pipes for stdin, stdout and stderr

func New

func New() (*Shell, error)

New creates a new powershell-process

func (*Shell) Close

func (s *Shell) Close() error

Close closes the underlying powershell-process

func (*Shell) Execute

func (s *Shell) Execute(cmd string) ([]byte, error)

Execute a specified command in the shell

func (*Shell) GetPid

func (s *Shell) GetPid() int

GetPid returns the process id for the powershell-process

func (*Shell) NewSession

func (s *Shell) NewSession(host string, opts ...Option) (*Session, error)

NewSession creates a new session

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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