Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param([int]$espkey, [int]$esp, [int]$bhopkey, [int]$triggerkey, [int]$trdelay, [int]$afterburst, [int]$aimkey, [float]$aimspeed, [int]$aimfov, [int]$aimbone, [float]$rcs, [int]$slowaimkey, [float]$slowaim, [int]$sleep, [int]$proc, [int]$client, [int]$bones, [int]$local, [int]$glowbase, [int]$attack, [int]$jump, [int]$sensitivity, [int]$incross, [int]$punch, [int]$angles)
  2.  
  3. Add-Type @'
  4. /*_*/
  5. /***/using System;/**/
  6. /***/using System.Runtime.InteropServices;/**/
  7. /**/
  8. public struct Win32
  9. {
  10. /*_*/
  11.     /***/[DllImport("kernel32.dll")]
  12.     public static extern IntPtr OpenProcess(int access, bool inheritHandler, uint processId);/**/
  13.  
  14.     /***/[DllImport("kernel32.dll")]
  15.     public static extern bool WriteProcessMemory(IntPtr process, IntPtr address, byte[] buffer, uint size, out uint written);/**/
  16.  
  17.     /***/[DllImport("Kernel32.dll")]
  18.     public static extern bool ReadProcessMemory(IntPtr process, IntPtr address, [In, Out] byte[] buffer, uint size, out uint read);/**/
  19.  
  20.     /***/[DllImport("user32.dll")]
  21.     public static extern int GetKeyState(int KeyStates);/**/
  22. /**/
  23. }
  24. '@
  25. <#_#>
  26. Get-Process -Id $proc
  27.  
  28. $handle = [Win32]::OpenProcess(0x438, $True, $proc)
  29.  
  30. $size = New-Object UInt32
  31.  
  32. <#*#>Function IsKeyDown($key)
  33. {
  34.     return [Convert]::ToBoolean([Win32]::GetKeyState($key) -band 0x8000)
  35. }<##>
  36.  
  37. <#*#>Function GetColor([float]$r, [float]$g, [float]$b, [float]$a)
  38. {
  39.     $color = New-Object byte[] 16
  40.     <#_#>
  41.     [Array]::Copy([BitConverter]::GetBytes($r), 0, $color, 0, 4)
  42.     [Array]::Copy([BitConverter]::GetBytes($g), 0, $color, 0x4, 4)
  43.     [Array]::Copy([BitConverter]::GetBytes($b), 0, $color, 0x8, 4)
  44.     [Array]::Copy([BitConverter]::GetBytes($a), 0, $color, 0xC, 4)
  45.     <##>
  46.     return $color
  47. }<##>
  48.  
  49. <#*#>Function ClampAngles([ref] [float]$pitch, [ref] [float]$yaw)
  50. {
  51.     <#_#>
  52.     <#*#>if($pitch.Value -gt 89) { $pitch.Value = 89 }
  53.     elseif($pitch.Value -lt -89) { $pitch.Value = -89 }<##>
  54.     <#*#>if($yaw.Value -gt 180) { do { $yaw.Value -= 360 } while($yaw.Value -gt 180) }
  55.     elseif($yaw.Value -lt -180) { do { $yaw.Value += 360 } while($yaw.Value -lt -180) }<##>
  56.     <##>
  57. }<##>
  58. <##>
  59.  
  60. <#_#>
  61. <#*0#>$sens = New-Object byte[] 4 <##>
  62. <#*1#>[void][Win32]::ReadProcessMemory($handle, $sensitivity, $sens, 4, [ref] $size)<##>
  63. <#*2#>$ssens = [BitConverter]::GetBytes([float]([BitConverter]::ToSingle($sens, 0) * $slowaim))<##>
  64. <#*0-2#>$trdelay *= 10000<##>
  65. <#*0-2#>$afterburst *= 10000<##>
  66. <#*0-2#>$rcs *= 2<##>
  67. <#*0-2#>$glowon = 0x01, 0x00<##>
  68. <#*0-2#>$color = New-Object byte[] 16 <##>
  69. <#*0-2#>$teamc = GetColor 0 1 0 0.7 <##>
  70. <#*0-2#>$dormantc = GetColor 0.2 0.2 0.2 0.9 <##>
  71. <#*0-2#>$enemylowc = GetColor 1 0.2 0.2 1 <##>
  72. <#*0-2#>$enemyc = GetColor 1 0.4 0 1 <##>
  73. <#*0-2#>$buffer = New-Object byte[] 0x25 <##>
  74. <#*0-2#>$buf = New-Object byte[] 8 <##>
  75. <#*0-2#>$localplayer = New-Object byte[] 0xDD <##>
  76. <#*0-2#>$player = New-Object byte[] 0x99 <##>
  77. <#*0-2#>$plocal = New-Object byte[] 4 <##>
  78. <#*0-2#>$targetb = New-Object byte[] 4 <##>
  79. <#*0-2#>$cam = New-Object float[] 3 <##>
  80. <#*0-2#>$angle = New-Object float[] 2 <##>
  81. <#*0-2#>$newang = New-Object float[] 2 <##>
  82. <#*0-2#>$recoil = New-Object float[] 2 <##>
  83. <##>
  84.  
  85.  
  86. while($True)
  87. {
  88.     [void][Win32]::ReadProcessMemory($handle, $local, $plocal, 4, [ref] $size)
  89.     $localptr = [BitConverter]::ToInt32($plocal, 0)
  90.     if($localptr -ne 0)
  91.     {
  92.         <#_#>
  93.         $notrigger = $noslow = $True
  94.         [void][Win32]::ReadProcessMemory($handle, $localptr + 0x64, $localplayer, 0xDD, [ref] $size)
  95.         <##>
  96.         <#_#>
  97.         <#*0-4#>if(IsKeyDown $aimkey)
  98.         {
  99.             <#_#>
  100.             <#*0#>$cam[0] = [BitConverter]::ToSingle($localplayer, 0xD0) + [BitConverter]::ToSingle($localplayer, 0xA0)<##>
  101.             <#*0#>$cam[1] = [BitConverter]::ToSingle($localplayer, 0xD4) + [BitConverter]::ToSingle($localplayer, 0xA4)<##>
  102.             <#*0#>$cam[2] = [BitConverter]::ToSingle($localplayer, 0xD8) + [BitConverter]::ToSingle($localplayer, 0xA8)<##>
  103.             <#*0#>[void][Win32]::ReadProcessMemory($handle, $angles, $buf, 8, [ref] $size)<##>
  104.             <#*1#>$angle[0] = [BitConverter]::ToSingle($buf, 0)<##>
  105.             <#*1#>$angle[1] = [BitConverter]::ToSingle($buf, 4)<##>
  106.             <#*2#>[void][Win32]::ReadProcessMemory($handle, $localptr + $punch, $buf, 8, [ref] $size)<##>
  107.             <#*3#>$recoil[0] = [BitConverter]::ToSingle($buf, 0) * $rcs<##>
  108.             <#*3#>$recoil[1] = [BitConverter]::ToSingle($buf, 4) * $rcs<##>
  109.             <#*0-3#>$aimon = $True<##>
  110.             <#*0-3#>$aiming = $False<##>
  111.             <#*0-3#>$mindiff = $aimfov<##>
  112.             <##>
  113.         }
  114.         else { $aimon = $False }<##>
  115.         <#*0-4#>if(IsKeyDown $espkey)
  116.         {
  117.             if($espkon)
  118.             {
  119.                 <#_#>
  120.                 if($esp -eq 2) { $esp = 0 } else { $esp++ }
  121.                 $espkon = $False
  122.                 <##>
  123.             }
  124.         }
  125.         else { $espkon = $True }<##>
  126.         <#*0-4#>if(IsKeyDown $bhopkey)
  127.         {
  128.             $state = $localplayer[0x9C]
  129.             if($state -ne 1 -and $state -ne 3 -and $state -ne 5 -and $state -ne 7)
  130.             {
  131.                 <#_#>
  132.                 [void][Win32]::WriteProcessMemory($handle, $jump, 0, 1, [ref] $size)
  133.                 $jumpoff = $True
  134.                 <##>
  135.             }
  136.             elseif($jumpoff)
  137.             {
  138.                 <#_#>
  139.                 [void][Win32]::WriteProcessMemory($handle, $jump, 1, 1, [ref] $size)
  140.                 $jumpoff = $False
  141.                 <##>
  142.             }
  143.         }<##>
  144.         <#*0#>[void][Win32]::ReadProcessMemory($handle, $localptr + $incross, $targetb, 4, [ref] $size)<##>
  145.         <#*1-4#>$target = [BitConverter]::ToInt32($targetb, 0)<##>
  146.  
  147.         <#*0-1#>[void][Win32]::ReadProcessMemory($handle, $glowbase, $buffer, 8, [ref] $size)<##>
  148.         <#*2#>$glow = [BitConverter]::ToInt32($buffer, 0)<##>
  149.         <#*2#>$glowslength = [BitConverter]::ToInt32($buffer, 4) * 0x38<##>
  150.         <#*3#>$glows = New-Object byte[] $glowslength <##>
  151.         <#*4#>[void][Win32]::ReadProcessMemory($handle, $glow, $glows, $glowslength, [ref] $size)<##>
  152.         <##>
  153.         for($i = 0; $i -lt $glowslength; $i+=0x38)
  154.         {
  155.             $ent = [BitConverter]::ToInt32($glows, $i)
  156.             if($ent -eq 0 -or $ent -eq $localptr) { continue }
  157.             [void][Win32]::ReadProcessMemory($handle, $ent + 0x64, $player, 0x99, [ref] $size)
  158.             $id = [BitConverter]::ToInt32($player, 0)
  159.             if($id -lt 1 -or $player[0x8C] -eq 0) { continue }
  160.             elseif($player[0x8C] -eq $localplayer[0x8C])
  161.             {
  162.                 <#_#>
  163.                 if($id -lt 64 -and $esp -lt 2) { continue }
  164.                 $color = $teamc
  165.                 <##>
  166.             }
  167.             else
  168.             {
  169.                 if($player[0x98] -ne 0)
  170.                 {
  171.                     if($player[0x85] -eq 1)
  172.                     {
  173.                         $color = $dormantc
  174.                     }
  175.                     else
  176.                     {
  177.                         <#_#>
  178.                         <#*#>[void][Win32]::WriteProcessMemory($handle, $ent + 0x935, 1, 1, [ref] $size)<##>
  179.                         <#*#>if($id -eq $target)
  180.                         {
  181.                             <#_#>
  182.                             if(IsKeyDown $triggerkey) { $notrigger = $False }
  183.                             if(IsKeyDown $slowaimkey) { $noslow = $False }
  184.                             <##>
  185.                         }<##>
  186.                         <#*#>if($aimon -and $player[0x98] -ne 0)
  187.                         {
  188.                             [void][Win32]::ReadProcessMemory($handle, $ent + $bones, $buffer, 4, [ref] $size)
  189.                             [void][Win32]::ReadProcessMemory($handle, [BitConverter]::ToInt32($buffer, 0) + 0x30 * $aimbone + 0xC, $buffer, 0x25, [ref] $size)
  190.                             $delta = ($cam[0]-[BitConverter]::ToSingle($buffer, 0)), ($cam[1]-[BitConverter]::ToSingle($buffer, 0x10)), ($cam[2]-[BitConverter]::ToSingle($buffer, 0x20))
  191.                             <#_#>
  192.                             <#*0-4#>$dist = [Math]::Sqrt($delta[0]*$delta[0] + $delta[1]*$delta[1] + $delta[2]*$delta[2])<##>  
  193.  
  194.                             <#*0#>$hyp = [Math]::Sqrt($delta[0]*$delta[0] + $delta[1]*$delta[1])<##>
  195.                             <#*1#>$pitch = [Math]::Atan($delta[2]/$hyp) * 57.2957795130823<##>
  196.                             <#*0#>$yaw = [Math]::Atan($delta[1]/$delta[0]) * 57.2957795130823<##>
  197.                             <#*1#>if($delta[0] -ge 0) { $yaw += 180 }<##>
  198.  
  199.                             <#*2#>$pitch -= $recoil[0]<##>
  200.                             <#*2#>$yaw -= $recoil[1]<##>
  201.  
  202.                             <#*3#>$pdiff = $angle[0] - $pitch<##>
  203.                             <#*3#>$ydiff = $angle[1] - $yaw<##>
  204.                             <#*4#>ClampAngles ([ref] $pdiff) ([ref] $ydiff)<##>
  205.                             <#*5#>$pdiffr = [Math]::Sin($pdiff * 0.0174532925199433) * $dist<##>
  206.                             <#*5#>$ydiffr = [Math]::Sin($ydiff * 0.0174532925199433) * $dist<##>
  207.                             <#*6#>$angdiffr = [Math]::Sqrt($pdiffr*$pdiffr + $ydiffr*$ydiffr)<##>
  208.                             <##>
  209.                            
  210.                             if($angdiffr -lt $mindiff -and [Math]::Abs($ydiff) -lt 90 -or ($dist*2 - $angdiffr) -lt $mindiff)
  211.                             {
  212.                                 <#_#>
  213.                                 $mindiff = $angdiffr
  214.                                 $aiming = $True
  215.                                 $pd = $pdiff
  216.                                 $yd = $ydiff
  217.                                 <##>
  218.                             }
  219.                         }<##>
  220.                         <#*#>if($player[0x98] -lt 25)
  221.                         {
  222.                             $color = $enemylowc
  223.                         }
  224.                         else
  225.                         {
  226.                             $color = $enemyc
  227.                         }<##>
  228.                         <##>
  229.                     }
  230.                 }
  231.                 elseif($id -gt 63)
  232.                 {
  233.                     $color = $enemylowc
  234.                 }
  235.                 else { continue }
  236.             }
  237.  
  238.             if($esp -ne 0)
  239.             {
  240.                 $diff = $False
  241.                 for($j = 0; $j -lt 16; $j++)
  242.                 {
  243.                     if($color[$j] -ne $glows[$i + $j])
  244.                     {
  245.                         $diff = $True
  246.                         break
  247.                     }
  248.                 }
  249.                 if($diff)
  250.                 {
  251.                     <#_#>
  252.                     [void][Win32]::WriteProcessMemory($handle, $glow + $i + 0x4, $color, 16, [ref] $size)
  253.                     [void][Win32]::WriteProcessMemory($handle, $glow + $i + 0x24, $glowon, 2, [ref] $size)
  254.                     <##>
  255.                 }
  256.             }
  257.         }
  258.         <#_#>
  259.         <#*#>if($notrigger)
  260.         {
  261.             <#_#>
  262.             <#*0#>if($attackon -and -not $afterb)
  263.             {
  264.                 <#_#>
  265.                 $trend = [DateTime]::Now.Ticks + $afterburst
  266.                 $afterb = $True
  267.                 <##>
  268.             }<##>
  269.             <#*1#>if($afterb -and $trend -le [DateTime]::Now.Ticks)
  270.             {
  271.                 <#_#>
  272.                 [void][Win32]::WriteProcessMemory($handle, $attack, 0, 1, [ref] $size)
  273.                 $attackon = $afterb = $False
  274.                 <##>
  275.             }<##>
  276.             <#*0-1#>$delayb = $True<##>
  277.             <##>
  278.         }
  279.         else
  280.         {
  281.             <#_#>
  282.             <#*0#>if($delayb)
  283.             {
  284.                 <#_#>
  285.                 $trstart = [DateTime]::Now.Ticks + $trdelay
  286.                 $delayb = $False
  287.                 <##>
  288.             }<##>
  289.             <#*1#>if(-not $attackon -and $trstart -lt [DateTime]::Now.Ticks)
  290.             {
  291.                 <#_#>
  292.                 [void][Win32]::WriteProcessMemory($handle, $attack, 1, 1, [ref] $size)
  293.                 $attackon = $True
  294.                 <##>
  295.             }<##>
  296.             <#*0-1#>$afterb = $False<##>
  297.             <##>
  298.         }<##>
  299.         <#*#>if($noslow -and $slowon)
  300.         {
  301.             <#_#>
  302.             [void][Win32]::WriteProcessMemory($handle, $sensitivity, $sens, 4, [ref] $size)
  303.             $slowon = $False
  304.             <##>
  305.         }
  306.         elseif(-not ($noslow -or $slowon))
  307.         {
  308.             <#_#>
  309.             [void][Win32]::WriteProcessMemory($handle, $sensitivity, $ssens, 4, [ref] $size)
  310.             $slowon = $True
  311.             <##>
  312.         }<##>
  313.         <#*#>if($aimon -and $aiming)
  314.         {
  315.             <#_#>
  316.             $pabs = [Math]::Abs($pd)
  317.             $yabs = [Math]::Abs($yd)
  318.             <##>
  319.             $angdiff = $pabs + $yabs
  320.             <#_#>
  321.             $pspeed = $pabs / $angdiff * $aimspeed
  322.             $yspeed = $yabs / $angdiff * $aimspeed
  323.             <##>
  324.             <#_#>
  325.             <#*#>if($pd -gt $pspeed) { $newang[0] = $angle[0] - $pspeed }
  326.             elseif($pd -lt -$pspeed) { $newang[0] = $angle[0] + $pspeed }
  327.             else { $newang[0] = $angle[0] - $pd }<##>
  328.             <#*#>if($yd -gt $yspeed) { $newang[1] = $angle[1] - $yspeed }
  329.             elseif($yd -lt -$yspeed) { $newang[1] = $angle[1] + $yspeed }
  330.             else { $newang[1] = $angle[1] - $yd }<##>
  331.             <##>
  332.             ClampAngles ([ref] $newang[0]) ([ref] $newang[1])
  333.             [Buffer]::BlockCopy($newang, 0, $buffer, 0, 8)
  334.             [void][Win32]::WriteProcessMemory($handle, $angles, $buffer, 8, [ref] $size)
  335.         }<##>
  336.         <##>
  337.     }
  338.     Start-Sleep -m $sleep
  339. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement