PowerShell

Running Commands as Another User with ScriptBlock

Crear objeto para jugar con ScriptBlock con las credenciales de otro usuario en otro equipo.

$SecPassword = ConvertTo-SecureString 'Password' -AsPlainText -Force

$Cred = New-Object System.Management.Automation.PSCredential('domain\user',$SecPassword)

Invoke-Command -ComputerName computer -Credential $Cred -ScriptBlock { whoami }

Encode a file with Base64 to transfer original file

# Desde el equipo victima convertimos el archivo 'file.bin' que no es legible a Base64
powershell -c "[convert]::ToBase64String((cat C:\\Temp\\file.bin -Encoding byte))"

[convert]::ToBase64String((cat C:\\Temp\\file.bin -Encoding byte))

# Desde el equipo atacante, descodificamos el contenido y obtenemos el archivo original. Nos hemos pasado el archivo solamente codificando en Base64.
echo '<BASE64_CODE>' | base64 -d > file.bin

PowerShell History commands

type $env:USERPROFILE\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

Última actualización

¿Te fue útil?