VPNClients
Compoundv2
Author: Evangelos Dragonas - Paul CABON CERT Almond
description
VPN Clients
includes (5)
paths
15 pathsfrom 5 targets
› paths use Windows environment syntax
collection commands
# PowerShell Artifact Collection Script
# Target: VPNClients
# Run as Administrator
#Requires -RunAsAdministrator
$ErrorActionPreference = "Continue"
$SourceRoot = "C:"
$DestBase = "D:\Evidence"
$Summary = @{ Copied = 0; Missed = 0; Errors = 0 }
function Collect-Artifact {
param(
[Parameter(Mandatory)][string]$SourceDir,
[Parameter(Mandatory)][string]$FolderName,
[string]$FileMask = "*"
)
# Expand wildcards in any path segment (e.g. 'Program Files*',
# 'ScreenConnect Client*'). robocopy itself does not glob the source.
$sources = @(Get-Item -Path $SourceDir -ErrorAction SilentlyContinue |
Where-Object { $_.PSIsContainer })
if ($sources.Count -eq 0) {
$Summary.Missed++
return
}
$FullDest = Join-Path -Path $DestBase -ChildPath $FolderName
$null = New-Item -ItemType Directory -Force -Path $FullDest -ErrorAction SilentlyContinue
foreach ($src in $sources) {
robocopy $src.FullName "$FullDest" "$FileMask" /E /COPY:DAT /R:0 /W:0 /NP /NFL /NDL /NJH /NJS 2>$null | Out-Null
if ($LASTEXITCODE -le 7) { $Summary.Copied++ } else { $Summary.Errors++ }
}
}
# 1. ProtonVPN - Service Logs
Collect-Artifact -SourceDir "C:\Program Files\Proton\VPN\v*\ServiceData\Logs" -FolderName "ProtonVPN_Service_Logs"
# 2. OpenVPN Client Config
Collect-Artifact -SourceDir "C:\Program Files*\OpenVPN\config" -FolderName "OpenVPN_Client_Config"
# 3. Palo Alto GlobalProtect VPN
Collect-Artifact -SourceDir "C:\Users\*\AppData\Local\Palo Alto Networks\GlobalProtect" -FileMask "PanGP*.log*" -FolderName "Palo_Alto_GlobalProtect_VPN"
# 4. Palo Alto GlobalProtect VPN
Collect-Artifact -SourceDir "C:\Program Files*\Palo Alto Networks\GlobalProtect" -FileMask "*.log*" -FolderName "Palo_Alto_GlobalProtect_VPN"
# 5. FortiClient trace logs in AppData
Collect-Artifact -SourceDir "C:\Users\*\AppData\Local\FortiClient\logs\trace" -FileMask "*" -FolderName "FortiClient_trace_logs_in_AppData"
# 6. FortiClient trace logs in Program Files
Collect-Artifact -SourceDir "C:\Program Files\Fortinet\FortiClient\logs\trace" -FileMask "*" -FolderName "FortiClient_trace_logs_in_Program_Files"
# 7. Pulse Secure logs in Programmes Files
Collect-Artifact -SourceDir "C:\Program Files (x86)\Pulse Secure\Logging" -FileMask "*" -FolderName "Pulse_Secure_logs_in_Programmes_Files"
# 8. Pulse Secure logs in ProgramData
Collect-Artifact -SourceDir "C:\ProgramData\Pulse Secure\Logging" -FileMask "*" -FolderName "Pulse_Secure_logs_in_ProgramData"
# 9. Pulse Secure setup logs
Collect-Artifact -SourceDir "C:\Users\*\AppData\Roaming\Pulse Secure\Setup Client" -FileMask "*.log" -FolderName "Pulse_Secure_setup_logs"
# 10. Pulse Secure PSAL logs
Collect-Artifact -SourceDir "C:\Users\*\AppData\Local\Pulse Secure\Logging" -FileMask "PulseClient.log" -FolderName "Pulse_Secure_PSAL_logs"
# Iterate every user profile under the source drive
Get-ChildItem "$SourceRoot\Users" -Directory -ErrorAction SilentlyContinue |
Where-Object { $_.Name -notin @('All Users', 'Default', 'Default User', 'Public') } |
ForEach-Object {
$UserName = $_.Name
# ProtonVPN - Connection Logs
$UserPath = "$($_.FullName)\AppData\Local\ProtonVPN\Logs"
Collect-Artifact -SourceDir $UserPath -FolderName "ProtonVPN_Connection_Logs_$UserName"
# ProtonVPN - Connection Logs
$UserPath = "$($_.FullName)\AppData\Local\Proton\Proton VPN\Logs"
Collect-Artifact -SourceDir $UserPath -FolderName "ProtonVPN_Connection_Logs_$UserName"
# ProtonVPN - Configuration
$UserPath = "$($_.FullName)\AppData\Local\Proton\Proton VPN\Storage"
Collect-Artifact -SourceDir $UserPath -FolderName "ProtonVPN_Configuration_$UserName"
# OpenVPN Client Config
$UserPath = "$($_.FullName)\OpenVPN\config"
Collect-Artifact -SourceDir $UserPath -FolderName "OpenVPN_Client_Config_$UserName"
# OpenVPN Client Config
$UserPath = "$($_.FullName)\OpenVPN\log"
Collect-Artifact -SourceDir $UserPath -FileMask "*.log" -FolderName "OpenVPN_Client_Config_$UserName"
}
Write-Host ("Collection complete. Copied: {0} Missed: {1} Errors: {2}" -f $Summary.Copied, $Summary.Missed, $Summary.Errors) -ForegroundColor Green› Save as .ps1 and run as Administrator. Use: powershell -ExecutionPolicy Bypass -File script.ps1
Note: This is a compound target that references 5 other targets. The KAPE command resolves them natively; the PowerShell/Batch/WSL scripts flatten every referenced path into explicit copy commands.
notes
To do: Add more targets for both enterprise (Cisco AnyConnect, Fortinet, etc.) and consumer VPN providers (NordVPN, ExpressVPN, etc.).