Notepad

Author: Andrew Rathbun, ogmini

description

A Target to collect files that are currently open in Notepad (Windows 11+)

paths

4 paths
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: Notepad
# Run as Administrator

#Requires -RunAsAdministrator

$ErrorActionPreference = "SilentlyContinue"
$DestBase = "D:\Evidence"

# Function to handle artifact collection with robocopy
function Collect-Artifact {
    param (
        [string]$SourceDir,
        [string]$FolderName,
        [string]$FileMask = "*"
    )
    $FullDest = Join-Path -Path $DestBase -ChildPath $FolderName
    robocopy "$SourceDir" "$FullDest" "$FileMask" /E /COPY:DAT /R:0 /W:0 /NP /NFL /NDL /NJH /NJS | Out-Null
}

# 1. Notepad Session Files
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\TabState"
Collect-Artifact -SourceDir "$UserPath" -FileMask "*.bin" -FolderName "Notepad_Session_Files"

# 2. Notepad Window State Files
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\WindowState\"
Collect-Artifact -SourceDir "$UserPath" -FileMask "*.bin" -FolderName "Notepad_Window_State_Files"

# 3. Notepad Settings File
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\Settings\"
Collect-Artifact -SourceDir "$UserPath" -FileMask "settings.dat" -FolderName "Notepad_Settings_File"

# 4. Notepad Registry Hives
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\SystemAppData\Helium"
Collect-Artifact -SourceDir "$UserPath" -FileMask "*.dat" -FolderName "Notepad_Registry_Hives"

Write-Host "Collection complete!" -ForegroundColor Green

Save as .ps1 and run as Administrator. Use: powershell -ExecutionPolicy Bypass -File script.ps1

› cyberchef recipes

Open in CyberChef to decode values extracted from this artifact.

references