Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.47 KB | None | 0 0
  1. AutoIT3 Join-/Anti-Afk - BGBot
  2.  
  3. Macros: /script JoinBattlefield(0);     auf + legen
  4.     /script AcceptBattlefieldPort(1,1); auf # legen
  5.  
  6. code:
  7. ----------------------------------------------------------------------------------
  8.  
  9. $Key_PvPWindow = "h"
  10. $Key_joinQueue = "{+}" ; /script JoinBattlefield(0);
  11. $Key_Confirm = "{#}" ; /script AcceptBattlefieldPort(1,1);
  12. $Key_Idle = "w"
  13. $Key_Idle2 = "s"
  14. $Key_autorun = "r"
  15.  
  16. SetPrivilege("SeDebugPrivilege", 1)
  17.  
  18. $Process = WinGetProcess("World of Warcraft")
  19. $hWnd = WinGetHandle("[CLASS:GxWindowClassD3d]")
  20.  
  21. $WoWProcess = mem_open($Process)
  22.  
  23. While True
  24.     $status = mem_read(0x00B6DFD8, $WoWProcess, "int")
  25.  
  26.     switch $status
  27.     Case 0
  28.         joinQueue()
  29.     Case 1
  30.         idle()
  31.     Case 2
  32.         confirm()
  33.     case 3
  34.         idle()
  35.     EndSwitch
  36. WEnd
  37.  
  38. Func joinQueue()
  39. Sleep(5000)
  40. ControlSend($hWnd, "", "", $Key_PvPWindow)
  41. ControlSend($hWnd, "", "", $Key_Idle)
  42. ControlSend($hWnd, "", "", $Key_Idle2)
  43.  
  44. Sleep(500)
  45. ControlSend($hWnd, "", "", $Key_joinQueue)
  46. Sleep(500)
  47. ControlSend($hWnd, "", "", $Key_Confirm)
  48. EndFunc
  49.  
  50. Func idle()
  51.     Sleep(6000)
  52.     ControlSend($hWnd, "", "", $Key_Idle)
  53.     ControlSend($hWnd, "", "", $Key_Idle2)
  54. EndFunc
  55.  
  56. Func confirm()
  57.     ControlSend($hWnd, "", "", $Key_Confirm)
  58.     Sleep(500)
  59. EndFunc
  60.  
  61. Func mem_open($iv_Pid)
  62.     Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
  63.     Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', 0x0bea4c8, 'int', 1, 'int', $iv_Pid)
  64.     $ah_Handle[1] = $av_OpenProcess[0]
  65.     Return $ah_Handle
  66. EndFunc
  67.  
  68. Func mem_read($iv_Address, $ah_Handle, $sv_Type = 'dword')
  69.     Local $v_Buffer = DllStructCreate($sv_Type)
  70.     DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
  71.     Local $v_Value = DllStructGetData($v_Buffer, 1)
  72.     Return $v_Value
  73. EndFunc
  74.  
  75. Func mem_close($ah_Handle)
  76.     DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
  77.     DllClose($ah_Handle[0])
  78.     Return 1
  79. EndFunc
  80.  
  81. Func SetPrivilege($privilege, $bEnable)
  82.     Const $MY_TOKEN_ADJUST_PRIVILEGES = 0x0020
  83.     Const $MY_TOKEN_QUERY = 0x0008
  84.     Const $MY_SE_PRIVILEGE_ENABLED = 0x0002
  85.     Local $hToken, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
  86.     $nTokens = 1
  87.     $LUID = DLLStructCreate("dword;int")
  88.     If IsArray($privilege) Then    $nTokens = UBound($privilege)
  89.     $TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
  90.     $NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
  91.     $hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
  92.     $SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","hwnd",$hCurrProcess[0],   _
  93.             "int",BitOR($MY_TOKEN_ADJUST_PRIVILEGES,$MY_TOKEN_QUERY),"int*",0)
  94.     If $SP_auxret[0] Then
  95.         $hToken = $SP_auxret[3]
  96.         DLLStructSetData($TOKEN_PRIVILEGES,1,1)
  97.         $nTokenIndex = 1
  98.         While $nTokenIndex <= $nTokens
  99.             If IsArray($privilege) Then
  100.                 $priv = $privilege[$nTokenIndex-1]
  101.             Else
  102.                 $priv = $privilege
  103.             EndIf
  104.             $ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue","str","","str",$priv,   _
  105.                     "ptr",DLLStructGetPtr($LUID))
  106.             If $ret[0] Then
  107.                 If $bEnable Then
  108.                     DLLStructSetData($TOKEN_PRIVILEGES,2,$MY_SE_PRIVILEGE_ENABLED,(3 * $nTokenIndex))
  109.                 Else
  110.                     DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
  111.                 EndIf
  112.                 DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,1),(3 * ($nTokenIndex-1)) + 1)
  113.                 DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,2),(3 * ($nTokenIndex-1)) + 2)
  114.                 DLLStructSetData($LUID,1,0)
  115.                 DLLStructSetData($LUID,2,0)
  116.             EndIf
  117.             $nTokenIndex += 1
  118.         WEnd
  119.         $ret = DLLCall("advapi32.dll","int","AdjustTokenPrivileges","hwnd",$hToken,"int",0,   _
  120.                 "ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",DllStructGetSize($NEWTOKEN_PRIVILEGES),   _
  121.                 "ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int*",0)
  122.         $f = DLLCall("kernel32.dll","int","GetLastError")
  123.     EndIf
  124.     $NEWTOKEN_PRIVILEGES=0
  125.     $TOKEN_PRIVILEGES=0
  126.     $LUID=0
  127.     If $SP_auxret[0] = 0 Then Return 0
  128.     $SP_auxret = DLLCall("kernel32.dll","int","CloseHandle","hwnd",$hToken)
  129.     If Not $ret[0] And Not $SP_auxret[0] Then Return 0
  130.     return $ret[0]
  131. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement