Add fixed native DNS Client completion probe and acceptance fixture

This commit is contained in:
Shirofune-Security committed 2026-09-21 09:33:53 +09:00
1 parent fd7a7924aa
commit 5967a6bc1e
14 files changed
+403 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
param([Parameter(Mandatory)][string]$Resolver,[Parameter(Mandatory)][string]$QueryName)
$ErrorActionPreference='Stop';$script:ScriptRoot=Split-Path $PSScriptRoot -Parent
[Console]::OutputEncoding=[Text.UTF8Encoding]::new($false)
. (Join-Path $PSScriptRoot 'WefArrival.ps1')
. (Join-Path $PSScriptRoot 'ChannelRead.ps1')
. (Join-Path $PSScriptRoot 'DnsClientProbe.ps1')
Initialize-WelaDnsClientProbeNative
if((Get-Service Dnscache -ErrorAction Stop).Status -ne 'Running'){throw 'DNS Client must already be running.'}
$before=Get-WelaChannelReader
$start=[DateTime]::UtcNow.ToString('o')
$query=[Wela.DnsClientProbe.Native]::Query($QueryName,$Resolver)
$end=[DateTime]::UtcNow.ToString('o')
$after=Get-WelaChannelReader
if((Get-WelaChannelReadKey $before) -cne (Get-WelaChannelReadKey $after)){throw 'Worker primary token changed during DNS query.'}
[pscustomobject]@{Query=$query;StartedUtc=$start;CompletedUtc=$end;ProcessId=$PID;BeforeToken=$before;AfterToken=$after}|ConvertTo-Json -Depth 12 -Compress