Signal

Author: Matt Dawson

description

Signal (Please view this tkape file for documentation on decryption!)

paths

4 paths
paths use Windows environment syntax

collection commands

# PowerShell Artifact Collection Script
# Target: Signal
# 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
        # Signal Attachments cache
        $UserPath = "$($_.FullName)\AppData\Roaming\Signal\attachments.noindex"
        Collect-Artifact -SourceDir $UserPath -FolderName "Signal_Attachments_cache_$UserName"
        # Signal Logs
        $UserPath = "$($_.FullName)\AppData\Roaming\Signal\logs"
        Collect-Artifact -SourceDir $UserPath -FolderName "Signal_Logs_$UserName"
        # Signal config.json
        $UserPath = "$($_.FullName)\AppData\Roaming\Signal"
        Collect-Artifact -SourceDir $UserPath -FileMask "config.json" -FolderName "Signal_config_json_$UserName"
        # Signal Database
        $UserPath = "$($_.FullName)\AppData\Roaming\Signal\sql"
        Collect-Artifact -SourceDir $UserPath -FileMask "db.sqlite" -FolderName "Signal_Database_$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

To decrypt db.sqlite on Windows:

1. Download https://sqlitebrowser.org/dl/ and open DB Browser for SQLCipher.exe

2. Get the key from config.json

3. Open the database from DB Browser/drag the file into the open window

4. Set the Password type from "Passphrase" to "Raw Key"

5. Set Encryption Settings to "SQLCipher 4 defaults"

6. Prefix the key from config.json with "0x" and paste it into the password field

included in collections