param([int]$TargetPid = 0) $t = "C:\Users\nicot\AppData\Local\Temp\opencode" if (-not $TargetPid) { $TargetPid = [int](Get-Content "$t\mcgame\pid.txt") } "scanning pid $TargetPid memory..." Add-Type @' using System; using System.Runtime.InteropServices; public class Mem { [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(uint a, bool b, int pid); [DllImport("kernel32.dll")] public static extern bool ReadProcessMemory(IntPtr h, IntPtr addr, byte[] buf, IntPtr size, out IntPtr read); [DllImport("kernel32.dll")] public static extern IntPtr CloseHandle(IntPtr h); [StructLayout(LayoutKind.Explicit)] public struct MBI { [FieldOffset(0)] public IntPtr BaseAddress; [FieldOffset(8)] public IntPtr AllocationBase; [FieldOffset(16)] public uint AllocationProtect; [FieldOffset(24)] public IntPtr RegionSize; [FieldOffset(32)] public uint State; [FieldOffset(36)] public uint Protect; [FieldOffset(40)] public uint Type; } [DllImport("kernel32.dll")] public static extern IntPtr VirtualQueryEx(IntPtr h, IntPtr addr, ref MBI mbi, IntPtr len); } '@ $h = [Mem]::OpenProcess(0x0410, $false, $TargetPid) if ($h -eq [IntPtr]::Zero) { "OpenProcess FAILED"; exit 1 } $L1 = [System.Text.Encoding]::GetEncoding(28591) $needles = @( "licenses/auth", "api.slinky", "remaining", "slinky/5.0", "POST /", "Authorization", "auth_blob", "inject_auth_blob", "session", "signature", "device_id", "hwid", "BEGIN PUBLIC KEY", "slinky_beta", ".slinky", "status: %lu", "BEGIN_BLOB" ) $byteNeedles = @( @{ n = "const 0x232B (9003)"; s = ($L1.GetString([byte[]](0x2B,0x23,0x00,0x00))) }, @{ n = "const 0x1B5B (7003)"; s = ($L1.GetString([byte[]](0x5B,0x1B,0x00,0x00))) }, @{ n = "const 0x1B5C (7004)"; s = ($L1.GetString([byte[]](0x5C,0x1B,0x00,0x00))) } ) function Show-Hit([string]$tag, [long]$base, [uint32]$prot, [uint32]$typ, [string]$regionStr, [int]$idx, [int]$needleLen) { $p = "" if ($prot -band 0x10) { $p = "R" } elseif ($prot -band 0x20) { $p = "RW" } elseif ($prot -band 0x40) { $p = "RX" } elseif ($prot -band 0x80) { $p = "RWX" } else { $p = ("0x{0:X}" -f $prot) } $tt = switch ($typ) { 0x1000000 { "IMG" } 0x40000 { "MAP" } 0x20000 { "PRV" } default { ("0x{0:X}" -f $typ) } } $s0 = [Math]::Max(0, $idx - 24) $len = [Math]::Min(130, $regionStr.Length - $s0) $ctxv = $regionStr.Substring($s0, $len) -replace '[^\x20-\x7e]', '.' "{0} @ 0x{1:X12} [{2} {3}] :: {4}" -f $tag, ($base + $idx), $p, $tt, $ctxv } $addr = [IntPtr]::Zero $regions = 0; $readMB = 0; $hits = 0 $endMax = [long]::MaxValue while ($true) { $mbi = New-Object Mem+MBI $r = [Mem]::VirtualQueryEx($h, $addr, [ref]$mbi, [IntPtr]::new([System.Runtime.InteropServices.Marshal]::SizeOf([type][Mem+MBI]))) if ($r -eq [IntPtr]::Zero) { break } $base = [long]$mbi.BaseAddress $size = [long]$mbi.RegionSize if ($size -le 0) { break } if ($base -ge $endMax) { break } if ($mbi.State -eq 0x1000 -and ($mbi.Protect -band 0xFF) -ne 0x01 -and ($mbi.Protect -band 0xFF) -ne 0x00) { $regions++ $cap = [Math]::Min($size, 256MB) $buf = New-Object byte[] $cap $read = [IntPtr]::Zero if ([Mem]::ReadProcessMemory($h, $mbi.BaseAddress, $buf, [IntPtr]$cap, [ref]$read) -and [long]$read -gt 0) { $readMB += ([long]$read) / 1MB $rs = $L1.GetString($buf, 0, [int]$read) foreach ($nd in $needles) { $i = 0; $count = 0 while (($i = $rs.IndexOf($nd, $i)) -ge 0 -and $count -lt 5) { Show-Hit "[STR $($nd.Substring(0,[Math]::Min(18,$nd.Length)))]" $base $mbi.Protect $mbi.Type $rs $i $nd.Length $hits++; $count++; $i += $nd.Length } } foreach ($bn in $byteNeedles) { $i = 0; $count = 0 while (($i = $rs.IndexOf($bn.s, $i)) -ge 0 -and $count -lt 5) { Show-Hit $bn.n $base $mbi.Protect $mbi.Type $rs $i 4 $hits++; $count++; $i += 4 } } } } $addr = [IntPtr]($base + $size) if ($addr -eq [IntPtr]::Zero) { break } } [Mem]::CloseHandle($h) | Out-Null "" "regions committed: $regions, read: $([Math]::Round($readMB)) MB, hits: $hits"