Documentation ¶
Overview ¶
Package windows contains helpers for Windows E2E tests
Index ¶
- func DisableDefender(host *components.RemoteHost) error
- func DownloadFile(host *components.RemoteHost, url string, destination string) error
- func FindPID(host *components.RemoteHost, pattern string) ([]int, error)
- func GetHostname(host *components.RemoteHost) (string, error)
- func GetJoinedDomain(host *components.RemoteHost) (string, error)
- func GetProductCodeByName(host *components.RemoteHost, name string) (string, error)
- func GetServiceStatus(host *components.RemoteHost, service string) (string, error)
- func GetTemporaryFile(host *components.RemoteHost) (string, error)
- func InstallMSI(host *components.RemoteHost, msiPath string, args string, logPath string) error
- func IsProcessRunning(host *components.RemoteHost, imageName string) (bool, error)
- func IsTamperProtected(host *components.RemoteHost) (bool, error)
- func MsiExec(host *components.RemoteHost, operation string, product string, args string, ...) error
- func NameToNetBIOSName(name string) string
- func PutOrDownloadFile(host *components.RemoteHost, url string, destination string) error
- func RepairAllMSI(host *components.RemoteHost, msiPath string, args string, logPath string) error
- func RestartService(host *components.RemoteHost, service string) error
- func StartService(host *components.RemoteHost, service string) error
- func StopService(host *components.RemoteHost, service string) error
- func UninstallMSI(host *components.RemoteHost, msiPath string, logPath string) error
- type AuthenticodeCertificate
- type AuthenticodeSignature
- type BoundPort
- type HostInfo
- type OSInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableDefender ¶ added in v0.52.0
func DisableDefender(host *components.RemoteHost) error
DisableDefender disables Windows Defender.
NOTE: Microsoft recently deprecated/removed/disabled the registry keys that were used to disable Windows Defender. This means the WinDefend service will still be running, but it should not interfere (as much). https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/security-malware-windows-defender-disableantispyware
TODO: Microsoft "recommends" to uninstall defender, but this only works on Windows Server and it requires a reboot.
func DownloadFile ¶ added in v0.52.0
func DownloadFile(host *components.RemoteHost, url string, destination string) error
DownloadFile downloads a file on the VM from a http/https URL
func FindPID ¶ added in v0.52.0
func FindPID(host *components.RemoteHost, pattern string) ([]int, error)
FindPID returns a list of PIDs for processes that match the given pattern
func GetHostname ¶ added in v0.52.0
func GetHostname(host *components.RemoteHost) (string, error)
GetHostname returns the hostname of the VM
func GetJoinedDomain ¶ added in v0.52.0
func GetJoinedDomain(host *components.RemoteHost) (string, error)
GetJoinedDomain returns the domain that the host is joined to
func GetProductCodeByName ¶
func GetProductCodeByName(host *components.RemoteHost, name string) (string, error)
GetProductCodeByName returns the product code GUID for the given product name
func GetServiceStatus ¶ added in v0.52.0
func GetServiceStatus(host *components.RemoteHost, service string) (string, error)
GetServiceStatus returns the status of the service
func GetTemporaryFile ¶
func GetTemporaryFile(host *components.RemoteHost) (string, error)
GetTemporaryFile returns a new temporary file path https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/new-temporaryfile?view=powershell-7.4
func InstallMSI ¶
func InstallMSI(host *components.RemoteHost, msiPath string, args string, logPath string) error
InstallMSI installs an MSI on the VM with the provided args and collects the install log
args may need to be escaped/quoted, see MsiExec() for details
func IsProcessRunning ¶ added in v0.52.0
func IsProcessRunning(host *components.RemoteHost, imageName string) (bool, error)
IsProcessRunning returns true if process is running
func IsTamperProtected ¶ added in v0.52.0
func IsTamperProtected(host *components.RemoteHost) (bool, error)
IsTamperProtected returns true if Windows Defender is tamper protected. If true, then Windows Defender cannot be disabled programatically and must be disabled through the UI.
func MsiExec ¶ added in v0.52.0
func MsiExec(host *components.RemoteHost, operation string, product string, args string, logPath string) error
MsiExec runs msiexec on the VM with the provided operation and args and collects the log
args may need to be escaped/quoted. The Start-Process ArgumentList parameter value is wrapped in single quotes. For example:
- Start-Process -Wait msiexec -PassThru -ArgumentList '/qn /l "logfile" /i "msipath" APIKEY="00000000000000000000000000000000"'
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.4#example-7-specifying-arguments-to-the-process
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.4
func NameToNetBIOSName ¶ added in v0.52.0
NameToNetBIOSName converts a given host or DNS name into a NetBIOS formatted name
Warning: This is not necessarily the actual NetBIOS name of the host, as it can be configured separately from the DNS name.
func PutOrDownloadFile ¶ added in v0.52.0
func PutOrDownloadFile(host *components.RemoteHost, url string, destination string) error
PutOrDownloadFile creates a file on the VM from a file/http URL
If the URL is a local file, it will be uploaded to the VM. If the URL is a remote file, it will be downloaded from the VM
func RepairAllMSI ¶ added in v0.52.0
func RepairAllMSI(host *components.RemoteHost, msiPath string, args string, logPath string) error
RepairAllMSI repairs an MSI with /fa on the VM and collects the repair log
/fa: a - forces all files to be reinstalled
args may need to be escaped/quoted, see MsiExec() for details
func RestartService ¶ added in v0.52.0
func RestartService(host *components.RemoteHost, service string) error
RestartService restarts the service
func StartService ¶ added in v0.52.0
func StartService(host *components.RemoteHost, service string) error
StartService starts the service
func StopService ¶ added in v0.52.0
func StopService(host *components.RemoteHost, service string) error
StopService stops the service
func UninstallMSI ¶
func UninstallMSI(host *components.RemoteHost, msiPath string, logPath string) error
UninstallMSI uninstalls an MSI on the VM and collects the uninstall log
Types ¶
type AuthenticodeCertificate ¶ added in v0.52.0
type AuthenticodeCertificate struct { Subject string `json:"Subject"` Issuer string `json:"Issuer"` Thumbprint string `json:"Thumbprint"` }
AuthenticodeCertificate represents the certificate used to sign the file
type AuthenticodeSignature ¶ added in v0.52.0
type AuthenticodeSignature struct { SignerCertificate AuthenticodeCertificate `json:"SignerCertificate"` Status int `json:"Status"` StatusMessage string `json:"StatusMessage"` }
AuthenticodeSignature is the result of GetAuthenticodeSignature()
func GetAuthenticodeSignature ¶ added in v0.52.0
func GetAuthenticodeSignature(host *components.RemoteHost, path string) (*AuthenticodeSignature, error)
GetAuthenticodeSignature returns the Authenticode signature of the file https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-authenticodesignature
func (*AuthenticodeSignature) Valid ¶ added in v0.52.0
func (s *AuthenticodeSignature) Valid() bool
Valid returns true if the signature is valid.
type BoundPort ¶ added in v0.52.0
type BoundPort struct {
// contains filtered or unexported fields
}
BoundPort represents a port that is bound to a process
func ListBoundPorts ¶ added in v0.52.0
func ListBoundPorts(host *components.RemoteHost) ([]*BoundPort, error)
ListBoundPorts returns a list of bound ports
func (*BoundPort) LocalAddress ¶ added in v0.52.0
LocalAddress returns the local address of the bound port
type HostInfo ¶ added in v0.52.0
HostInfo contains information about a Windows host, such as the hostname and version
func GetHostInfo ¶ added in v0.52.0
func GetHostInfo(host *components.RemoteHost) (*HostInfo, error)
GetHostInfo returns HostInfo for the given VM
func (*HostInfo) IsDomainController ¶ added in v0.52.0
IsDomainController returns true if the host is a domain controller
type OSInfo ¶ added in v0.52.0
type OSInfo struct { WindowsDirectory string `json:"WindowsDirectory"` Version string `json:"Version"` SystemDrive string `json:"SystemDrive"` SystemDirectory string `json:"SystemDirectory"` ProductType int `json:"ProductType"` OSType int `json:"OSType"` OSProductSuite int `json:"OSProductSuite"` OSLanguage int `json:"OSLanguage"` Locale string `json:"Locale"` BuildNumber string `json:"BuildNumber"` Caption string `json:"Caption"` }
OSInfo contains a selection of values from: Get-WmiObject Win32_OperatingSystem https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem
func GetOSInfo ¶ added in v0.52.0
func GetOSInfo(host *components.RemoteHost) (*OSInfo, error)
GetOSInfo returns OSInfo for the given VM
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package agent includes helpers related to the Datadog Agent on Windows
|
Package agent includes helpers related to the Datadog Agent on Windows |
installers/v2
Package installers processes the installers_v2.json file
|
Package installers processes the installers_v2.json file |