Release 0.0.6 with usable GUI diagnostics and capture controls
Windows tests / test-and-build (push) Canceled after 0s
Windows tests / test-and-build (push) Canceled after 0s
This commit is contained in:
1 parent
65f302279d
commit
41bb252214
18 files changed
+81
-37
No files matched your search
+7
-6
@@ -1,7 +1,7 @@
|
||||
#Requires -Version 5.1
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[ValidateSet('Plan','Apply','Restore','Confirm','Validate','CaptureStart','CaptureStop')][string]$Mode='Plan',
|
||||
[ValidateSet('Plan','Apply','Restore','Confirm','Validate','CaptureStart','CaptureStop','CaptureConvert')][string]$Mode='Plan',
|
||||
[ValidateSet('Observe','BlockOptionalTelemetry','Isolate')][string]$Profile='Observe',
|
||||
[int]$RollbackMinutes=10,[string]$Journal,[string]$CaptureDirectory,[switch]$FromRecoveryTask,[switch]$Json
|
||||
)
|
||||
@@ -22,18 +22,19 @@ if($Mode -eq 'CaptureStart'){
|
||||
[pscustomobject]@{Status='Running';Directory=$CaptureDirectory;Warning='Capture can contain private addresses and DNS names. Stop and delete or export it explicitly.'}|ConvertTo-Json
|
||||
return
|
||||
}
|
||||
if($Mode -eq 'CaptureStop'){
|
||||
if(-not $CaptureDirectory){throw 'CaptureStop requires -CaptureDirectory.'};$full=Resolve-WindCaptureDirectory -Path $CaptureDirectory -StateRoot $stateRoot
|
||||
if(-not $PSCmdlet.ShouldProcess($full,'Stop packet capture and convert to PCAPNG')){return}
|
||||
if($Mode -in @('CaptureStop','CaptureConvert')){
|
||||
if(-not $CaptureDirectory){throw "$Mode requires -CaptureDirectory."};$full=Resolve-WindCaptureDirectory -Path $CaptureDirectory -StateRoot $stateRoot
|
||||
$action=if($Mode-eq'CaptureStop'){'Stop packet capture and convert to PCAPNG'}else{'Convert saved packet capture to PCAPNG'}
|
||||
if(-not $PSCmdlet.ShouldProcess($full,$action)){return}
|
||||
Assert-WindMutationAllowed
|
||||
$etl=Join-Path $full 'capture.etl';$pcap=Join-Path $full 'capture.pcapng'
|
||||
if(-not(Test-Path -LiteralPath $etl -PathType Leaf)){throw 'Capture ETL file is missing; no capture was stopped.'}
|
||||
if(Test-Path -LiteralPath $pcap){throw 'Converted capture already exists; preserve or move it before retrying conversion.'}
|
||||
Invoke-WindPacketMonitor -ArgumentList @('stop')
|
||||
if($Mode-eq'CaptureStop'){Invoke-WindPacketMonitor -ArgumentList @('stop')}
|
||||
Invoke-WindPacketMonitor -ArgumentList @('etl2pcap',$etl,'--out',$pcap)
|
||||
if(-not(Test-Path -LiteralPath $pcap -PathType Leaf)){throw 'Packet capture conversion returned success without creating the PCAPNG file.'}
|
||||
Save-WindJournal -Journal (Get-WindNetworkValidation) -Path (Join-Path $full 'connections.json')
|
||||
Write-Output "Capture stopped: $full";return
|
||||
Write-Output "Capture converted: $pcap";return
|
||||
}
|
||||
Assert-WindMutationAllowed
|
||||
if($Mode -eq 'Apply'){
|
||||
|
||||
Reference in new issue
Block a user