dfirhub

LinuxOnWindowsProfileFiles

Author: Troy Larson

description

Linux on Windows Profile Files

paths

4 paths
Windows Linux Profile.bash_history
C:\Users\%user%\AppData\Local\Packages\*\LocalState\rootfs\home\*\.bash_history
Windows Linux Profile.bash_logout
C:\Users\%user%\AppData\Local\Packages\*\LocalState\rootfs\home\*\.bash_logout
Windows Linux Profile.bashrc
C:\Users\%user%\AppData\Local\Packages\*\LocalState\rootfs\home\*\.bashrc
Windows Linux Profile.profile
C:\Users\%user%\AppData\Local\Packages\*\LocalState\rootfs\home\*\.profile
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: LinuxOnWindowsProfileFiles
# 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. .bash_history
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\*\LocalState\rootfs\home\*\"
Collect-Artifact -SourcePath "$UserPath\.bash_history" -FolderName "_bash_history"

# 2. .bash_logout
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\*\LocalState\rootfs\home\*\"
Collect-Artifact -SourcePath "$UserPath\.bash_logout" -FolderName "_bash_logout"

# 3. .bashrc
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\*\LocalState\rootfs\home\*\"
Collect-Artifact -SourcePath "$UserPath\.bashrc" -FolderName "_bashrc"

# 4. .profile
$UserPath = Join-Path $env:USERPROFILE "AppData\Local\Packages\*\LocalState\rootfs\home\*\"
Collect-Artifact -SourcePath "$UserPath\.profile" -FolderName "_profile"

Write-Host "Collection complete!" -ForegroundColor Green

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