AgentRansack

Author: Andrew Rathbun

description

Agent Ransack - Free File Searching Utility

paths

4 paths
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: AgentRansack
# 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++ }
    }
}

# 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
        # Agent Ransack Config Logs
        $UserPath = "$($_.FullName)\AppData\Roaming\Mythicsoft\AgentRansack\config"
        Collect-Artifact -SourceDir $UserPath -FolderName "Agent_Ransack_Config_Logs_$UserName"
        # Agent Ransack CrashReports Logs
        $UserPath = "$($_.FullName)\AppData\Roaming\Mythicsoft\AgentRansack\CrashReports"
        Collect-Artifact -SourceDir $UserPath -FolderName "Agent_Ransack_CrashReports_Logs_$UserName"
        # Agent Ransack IndexLog Logs
        $UserPath = "$($_.FullName)\AppData\Roaming\Mythicsoft\AgentRansack\IndexLog"
        Collect-Artifact -SourceDir $UserPath -FolderName "Agent_Ransack_IndexLog_Logs_$UserName"
        # Agent Ransack Logs
        $UserPath = "$($_.FullName)\AppData\Roaming\Mythicsoft\AgentRansack\logs"
        Collect-Artifact -SourceDir $UserPath -FolderName "Agent_Ransack_Logs_$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

references

notes

.\AppData\Roaming\Mythicsoft\AgentRansack\config\history.xml - appears to track user's search terms

.\AppData\Roaming\Mythicsoft\AgentRansack\logs\AgentRansack-app.log - appears to log when searches are conducted, similar to the below:

2023.07.13 15:51:16:291 (56020.117972) Starting search

2023.07.13 15:51:16:309 (56020.117972) Search started