Documentation
¶
Index ¶
- func AwaitServiceRunning(name string, timeout time.Duration) error
- func CheckTestSigningAttribute(provider CmdOutputProvider) (bool, error)
- func CondenseNetWithPortRange(nwps []akn.NetWithPortRange, limit int) []akn.NetWithPortRange
- func ExecutePowershellCommand(ctx context.Context, cmds []string) (string, error)
- func FindProcessIds(processOrPid string) []int
- func GetAvailableDriveLetters() ([]string, error)
- func GetDriveSpace(driveLetter string) (free uint64, total uint64, err error)
- func IsExecutableOperational(executableName string, args ...string) error
- func IsProcessRunning(processName string) (bool, error)
- func IsTestSigningEnabled() (bool, error)
- func IsWindowsHomeEdition() bool
- func MapToNetworks(ctx context.Context, ipsOrCidrsOrHostnames ...string) ([]net.IPNet, error)
- func ParsePortRanges(raw []string) ([]akn.PortRange, error)
- func PowershellCommand(args ...string) *exec.Cmd
- func Resolve(ctx context.Context, hostnames ...string) ([]net.IP, error)
- func ShiftSystemTime(offset time.Duration) error
- func StartService(name string, timeout time.Duration) error
- func StopProcess(processName string) error
- func StopProcesses(pids []int, force bool) error
- func StopService(name string, timeout time.Duration) error
- func SystemExecutable(name string) string
- type CmdOutputProvider
- type HostnameInput
- type HostnameOutput
- type HostnameResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AwaitServiceRunning ¶ added in v0.5.0
AwaitServiceRunning waits until the given service exists and is running, e.g. a driver service installed on demand.
func CheckTestSigningAttribute ¶ added in v0.2.3
func CheckTestSigningAttribute(provider CmdOutputProvider) (bool, error)
func CondenseNetWithPortRange ¶
func CondenseNetWithPortRange(nwps []akn.NetWithPortRange, limit int) []akn.NetWithPortRange
CondenseNetWithPortRange condenses a list of NetWithPortRange The way this algorithm works: 1. Sort the nwp list ascending by BaseIP and port 2. For each nwp in the list create a new nwp with the next neighbor if port-ranges are compatible 3. From the new list choose the nwp with the longest prefix length, remove all nwp witch are included in the chosen and add the chosen nwp to the result list 4. Repeat 3. until either the list is shorter than limit or no more compatible nwp are found
func ExecutePowershellCommand ¶
ExecutePowershellCommand runs the given commands in a powershell session. Callers must make sure that passed in commands are properly sanitizes.
func FindProcessIds ¶ added in v0.5.0
FindProcessIds returns the given pid, or the pids of all processes whose executable name contains processOrPid.
func GetAvailableDriveLetters ¶ added in v0.2.0
func GetDriveSpace ¶ added in v0.2.0
GetDriveSpace returns the free and the total bytes of the given drive.
func IsExecutableOperational ¶ added in v0.2.0
func IsProcessRunning ¶ added in v0.2.0
IsProcessRunning reports whether a process with the given name is running. Like Get-Process -Name, the name is matched case-insensitively against the executable name without its ".exe" extension.
func IsTestSigningEnabled ¶ added in v0.2.3
func IsWindowsHomeEdition ¶ added in v0.5.0
func IsWindowsHomeEdition() bool
IsWindowsHomeEdition reports whether Windows runs as a Home edition, which does not apply policy-based QoS.
func MapToNetworks ¶
func PowershellCommand ¶ added in v0.2.0
func ShiftSystemTime ¶ added in v0.5.0
ShiftSystemTime moves the system clock by the given offset.
func StartService ¶ added in v0.5.0
StartService starts the given Windows service and waits until it is running. A running service is left as is.
func StopProcess ¶ added in v0.2.0
StopProcess forcefully terminates all processes with the given name, see IsProcessRunning for the matching.
func StopProcesses ¶ added in v0.5.0
func StopService ¶ added in v0.5.0
StopService stops the given Windows service and waits until it is stopped. A stopped service is left as is. A service that does not exist yields windows.ERROR_SERVICE_DOES_NOT_EXIST.
func SystemExecutable ¶ added in v0.5.0
SystemExecutable returns the absolute path of a tool in the Windows system directory, so that no executable with the same name found earlier in PATH is started instead.
Types ¶
type CmdOutputProvider ¶ added in v0.2.3
type HostnameInput ¶
func (*HostnameInput) Resolve ¶
func (i *HostnameInput) Resolve(_ context.Context) (*HostnameOutput, error)
Resolve queries the Windows DNS client like Resolve-DnsName does, including the hosts file, the DNS cache and LLMNR/NetBIOS for local names.