OpenSSHServer
Appsv1
Author: Matt Dawson
description
OpenSSH Server Config and Logs
paths
9 paths
AppsOpenSSH Server Config File
C:\ProgramData\ssh\sshd_configConfig file can hold information on allowed/denied users
AppsOpenSSH Server Logs
C:\ProgramData\ssh\logs\*OpenSSH server logs
AppsOpenSSH Host ECDSA Key
C:\ProgramData\ssh\ssh_host_ecdsa_keyRetrieves the host ECDSA key
AppsOpenSSH Host ED25519 Key
C:\ProgramData\ssh\ssh_host_ed25519_keyRetrieves the host ED25519 key
AppsOpenSSH Host DSA Key
C:\ProgramData\ssh\ssh_host_dsa_keyRetrieves the host DSA key
AppsOpenSSH Host RSA Key
C:\ProgramData\ssh\ssh_host_rsa_keyRetrieves the host RSA key
AppsOpenSSH User Authorized Keys
C:\Users\%user%\.ssh\authorized_keysRetrieves the user's authorised public keys
AppsOpenSSH User Authorized Keys 2
C:\Users\%user%\.ssh\authorized_keys2Retrieves the user's authorised public keys from the second file
AppsOpenSSH Authorized Administrator Keys
C:\ProgramData\ssh\administrators_authorized_keysRetrieves the administrator group's authorised public keys
› paths use Windows environment syntax
collection commands
# PowerShell Artifact Collection Script
# Target: OpenSSHServer
# Run as Administrator
#Requires -RunAsAdministrator
$ErrorActionPreference = "SilentlyContinue"
$DestBase = "D:\Evidence"
# Function to handle directory creation and copying
function Collect-Artifact {
param (
[string]$SourcePath,
[string]$FolderName
)
$FullDest = Join-Path -Path $DestBase -ChildPath $FolderName
if (-not (Test-Path -Path $FullDest)) {
New-Item -ItemType Directory -Path $FullDest -Force | Out-Null
}
Copy-Item -Path $SourcePath -Destination $FullDest -Recurse -Force
}
# 1. OpenSSH Server Config File
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\sshd_config" -FolderName "OpenSSH_Server_Config_File"
# 2. OpenSSH Server Logs
Collect-Artifact -SourcePath "C:\ProgramData\ssh\logs\\*" -FolderName "OpenSSH_Server_Logs"
# 3. OpenSSH Host ECDSA Key
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\ssh_host_ecdsa_key" -FolderName "OpenSSH_Host_ECDSA_Key"
# 4. OpenSSH Host ED25519 Key
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\ssh_host_ed25519_key" -FolderName "OpenSSH_Host_ED25519_Key"
# 5. OpenSSH Host DSA Key
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\ssh_host_dsa_key" -FolderName "OpenSSH_Host_DSA_Key"
# 6. OpenSSH Host RSA Key
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\ssh_host_rsa_key" -FolderName "OpenSSH_Host_RSA_Key"
# 7. OpenSSH User Authorized Keys
$UserPath = Join-Path $env:USERPROFILE ".ssh\"
Collect-Artifact -SourcePath "$UserPath\authorized_keys" -FolderName "OpenSSH_User_Authorized_Keys"
# 8. OpenSSH User Authorized Keys 2
$UserPath = Join-Path $env:USERPROFILE ".ssh\"
Collect-Artifact -SourcePath "$UserPath\authorized_keys2" -FolderName "OpenSSH_User_Authorized_Keys_2"
# 9. OpenSSH Authorized Administrator Keys
Collect-Artifact -SourcePath "C:\ProgramData\ssh\\administrators_authorized_keys" -FolderName "OpenSSH_Authorized_Administrator_Keys"
Write-Host "Collection complete!" -ForegroundColor Green› Save as .ps1 and run as Administrator. Use: powershell -ExecutionPolicy Bypass -File script.ps1