Guest User

Css python bhop script v4

a guest
Apr 16th, 2013
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.74 KB | None | 0 0
  1. '''
  2. Python bhop script by HaloShadoW as a joke
  3.  
  4. INSTRUCTIONS:
  5. bind f7 "+jump 32; -jump 32"
  6. bind space "+jump 32; -jump 32"
  7. '''
  8.  
  9. from ctypes import *;
  10. from time import sleep;
  11. import os;
  12.  
  13. os.system("color 0B")
  14. os.system("cls");
  15.  
  16. OpenProcess               = windll.kernel32.OpenProcess
  17. ReadProcessMemory         = windll.kernel32.ReadProcessMemory
  18. WriteProcessMemory        = windll.kernel32.WriteProcessMemory
  19. CreateToolhelp32Snapshot  = windll.kernel32.CreateToolhelp32Snapshot
  20. Process32First            = windll.kernel32.Process32First
  21. Process32Next             = windll.kernel32.Process32Next
  22. Module32First             = windll.kernel32.Module32First
  23. Module32Next              = windll.kernel32.Module32Next
  24. CloseHandle               = windll.kernel32.CloseHandle
  25. GetAsyncKeyState          = windll.User32.GetAsyncKeyState
  26. SendMessage               = windll.User32.SendMessageA
  27. keybd_event               = windll.User32.keybd_event
  28. FindWindow                = windll.User32.FindWindowA
  29.  
  30. class PROCESSENTRY32(Structure):
  31.     _fields_ = [("dwSize", c_ulong),("cntUsage", c_ulong),("th32ProcessID", c_ulong),("th32DefaultHeapID", c_ulong),("th32ModuleID", c_ulong),("cntThreads", c_ulong),("th32ParentProcessID", c_ulong),("pcPriClassBase", c_ulong),("dwFlags", c_ulong),("szExeFile", c_char * 260)]
  32. class MODULEENTRY32(Structure):
  33.     _fields_ = [( 'dwSize' , c_ulong ) , ( 'th32ModuleID' , c_ulong ),( 'th32ProcessID' , c_ulong ),( 'GlblcntUsage' , c_ulong ),( 'ProccntUsage' , c_ulong ) ,( 'modBaseAddr' , c_void_p ) ,( 'modBaseSize' , c_ulong ) , ( 'hModule' , c_void_p ) ,( 'szModule' , c_char * 256 ),( 'szExePath' , c_char * 260 ) ]
  34.  
  35. def GetPIDByName(ProcessName):
  36.      hProcessSnap = CreateToolhelp32Snapshot(0x00000002, 0)
  37.      pe32 = PROCESSENTRY32()
  38.      pe32.dwSize = sizeof(PROCESSENTRY32)
  39.      Process32First(hProcessSnap, byref(pe32))
  40.      pid = None
  41.      while True:
  42.          if (pe32.szExeFile.lower()==ProcessName.lower()):
  43.              pid=pe32.th32ProcessID
  44.              break
  45.          if not Process32Next(hProcessSnap, byref(pe32)):
  46.              break
  47.      CloseHandle(hProcessSnap)
  48.      return pid
  49.    
  50. def GetModuleBase(PID,ModuleName):
  51.     hModuleSnap = CreateToolhelp32Snapshot( 0x00000008, PID );
  52.     me32 = MODULEENTRY32()
  53.     me32.dwSize = sizeof(MODULEENTRY32)
  54.     Module32First( hModuleSnap, byref(me32))
  55.     base = None
  56.     while True:
  57.         if (me32.szModule.lower()==ModuleName.lower()):
  58.             base=me32.modBaseAddr
  59.             break
  60.         if not Module32Next(hModuleSnap, byref(me32)):
  61.             break
  62.     CloseHandle(hModuleSnap)
  63.     return base
  64.  
  65. ProcID = GetPIDByName('hl2.exe');
  66.  
  67. while (ProcID == None):
  68.     sleep(1);
  69.     os.system("cls");
  70.     print "\t\t\tWaiting for \"hl2.exe\"";
  71.     ProcID = GetPIDByName('hl2.exe');
  72.  
  73. EngineBase = GetModuleBase(ProcID, 'engine.dll');
  74.  
  75. while (EngineBase == None):
  76.     sleep(1);
  77.     os.system("cls");
  78.     print "\t\t\tWaiting for \"engine.dll\"";
  79.     EngineBase = GetModuleBase(ProcID, 'engine.dll');
  80.  
  81. ClientBase = GetModuleBase(ProcID, 'client.dll');
  82.  
  83. while (ClientBase == None):
  84.     sleep(1);
  85.     os.system("cls");
  86.     print "\t\t\tWaiting for \"client.dll\"";
  87.     ClientBase = GetModuleBase(ProcID, 'client.dll');
  88.  
  89. VGuiBase = GetModuleBase(ProcID, 'vguimatsurface.dll');
  90.  
  91. while (VGuiBase == None):
  92.     sleep(1);
  93.     os.system("cls");
  94.     print "\t\t\tWaiting for \"vguimatsurface.dll\"";
  95.     VGuiBase = GetModuleBase(ProcID, 'vguimatsurface.dll');
  96.  
  97. ProcHandle = OpenProcess(0x1FFFFF, 0, ProcID);
  98.  
  99. while (ProcHandle == None):
  100.     sleep(1);
  101.     os.system("cls");
  102.     print "\t\t\tWaiting for process handle.";
  103.     ProcHandle = OpenProcess(0x1FFFFF, 0, ProcID);
  104.  
  105. ProcHWND = FindWindow('Valve001', 0);
  106.  
  107. while (ProcHWND == None):
  108.     sleep(1);
  109.     os.system("cls");
  110.     print "\t\t\tWaiting for process window";
  111.     ProcHWND = FindWindow('Valve001', 0);
  112.  
  113. onGroundAddr = ClientBase+0x5759A8;
  114. InWaterAddr = ClientBase+0x57367C;
  115. EscAddr = VGuiBase+0x130020;
  116.  
  117. os.system("cls");
  118.  
  119. print "Proccess ID:",ProcID,"\nEngine.dll Module Base:",EngineBase,"\nClient.dll Module Base:",ClientBase,"\nProccess Handler:",ProcHandle,"\nCS:S Window ID:",ProcHWND,"\n";
  120. print "\nPython bunnyhop script by HaloShadoW - v3 by 0f1r and Shavit.\n\nChanges:\nBetter jump delay.\nWon't hop when typing in console.\nJump on ladders.\nJump on/in water.\nSupport for restarting the game.\n\nHow to use?\nType 'bind space \"+jump 32; -jump 32\"' in your in-game console press ENTER.\nType 'bind f7 \"+jump 32; -jump 32\"' in your console press ENTER.\nType 'bind f8 \"+jump\"' in your console press ENTER.";
  121. print "\nVGuiID:",VGuiBase,""
  122.  
  123. bytesRead = c_uint();
  124. onGround  = c_ulong();
  125. EscOn  = c_ulong();
  126. inWater = c_ulong();
  127.  
  128. while True:
  129.     sleep(.00171);
  130.     if(GetAsyncKeyState(32) & 0x80000000):
  131.         ReadProcessMemory(ProcHandle, c_void_p(EscAddr), byref(EscOn), 4, byref(bytesRead));
  132.         if(EscOn.value == 0):
  133.             ReadProcessMemory(ProcHandle, c_void_p(InWaterAddr), byref(inWater), 4, byref(bytesRead));
  134.             ReadProcessMemory(ProcHandle,c_void_p(onGroundAddr),byref(onGround),4,byref(bytesRead));
  135.             if(not onGround.value == 4294967295):
  136.                 keybd_event(0x76,0x41,0,0);
  137.                 keybd_event(0x76,0x41,2,0);
  138.             elif(not inWater.value == 0):
  139.                 keybd_event(0x77,0x42,0,0);
  140.                 sleep(.00171);
  141.                 keybd_event(0x77,0x42,2,0);
  142.  
  143.     ProcID = GetPIDByName('hl2.exe');
  144.  
  145.     if(ProcID == None):
  146.         os.system("cls");
  147.  
  148.         ProcID = GetPIDByName('hl2.exe');
  149.  
  150.         while (ProcID == None):
  151.             sleep(1);
  152.             os.system("cls");
  153.             print "\t\t\tWaiting for \"hl2.exe\"";
  154.             ProcID = GetPIDByName('hl2.exe');
  155.  
  156.         EngineBase = GetModuleBase(ProcID, 'engine.dll');
  157.  
  158.         while (EngineBase == None):
  159.             sleep(1);
  160.             os.system("cls");
  161.             print "\t\t\tWaiting for \"engine.dll\"";
  162.             EngineBase = GetModuleBase(ProcID, 'engine.dll');
  163.  
  164.         ClientBase = GetModuleBase(ProcID, 'client.dll');
  165.  
  166.         while (ClientBase == None):
  167.             sleep(1);
  168.             os.system("cls");
  169.             print "\t\t\tWaiting for \"client.dll\"";
  170.             ClientBase = GetModuleBase(ProcID, 'client.dll');
  171.  
  172.         VGuiBase = GetModuleBase(ProcID, 'vguimatsurface.dll');
  173.  
  174.         while (VGuiBase == None):
  175.             sleep(1);
  176.             os.system("cls");
  177.             print "\t\t\tWaiting for \"vguimatsurface.dll\"";
  178.             VGuiBase = GetModuleBase(ProcID, 'vguimatsurface.dll');
  179.  
  180.         ProcHandle = OpenProcess(0x1FFFFF, 0, ProcID);
  181.  
  182.         while (ProcHandle == None):
  183.             sleep(1);
  184.             os.system("cls");
  185.             print "\t\t\tWaiting for process handle.";
  186.             ProcHandle = OpenProcess(0x1FFFFF, 0, ProcID);
  187.  
  188.         ProcHWND = FindWindow('Valve001', 0);
  189.  
  190.         while (ProcHWND == None):
  191.             sleep(1);
  192.             os.system("cls");
  193.             print "\t\t\tWaiting for process window";
  194.             ProcHWND = FindWindow('Valve001', 0);
  195.  
  196.         onGroundAddr = ClientBase+0x5759A8;
  197.         InWaterAddr = ClientBase+0x57367C;
  198.         EscAddr = VGuiBase+0x130020;
  199.  
  200.         os.system("cls");
  201.  
  202.         print "Proccess ID:",ProcID,"\nEngine.dll Module Base:",EngineBase,"\nClient.dll Module Base:",ClientBase,"\nProccess Handler:",ProcHandle,"\nCS:S Window ID:",ProcHWND,"\n";
  203.         print "\nPython bunnyhop script by HaloShadoW - v3 by 0f1r and Shavit.\n\nChanges:\nBetter jump delay.\nWon't hop when typing in console.\nJump on ladders\nSupport for restarting the game.\n\nHow to use?\nType 'bind space \"+jump 32; -jump 32\"' in your in-game console press ENTER.\nType 'bind f7 \"+jump 32; -jump 32\"' in your console press ENTER.";
  204.         continue;
Advertisement
Add Comment
Please, Sign In to add comment