diff --git a/main.py b/main.py index 8ba371f..6d8060f 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,9 @@ class Hack(): self.pm = self._find_process(True) + self.wait_time = 0.01 + self.timeout = self.wait_time * 50 + def _find_offsets(self) -> dict[str, int]: hazedumper_data = get( "https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.min.json") @@ -40,6 +43,7 @@ class Hack(): exit(1) def find_module(self, module: str): + """Find module address""" found = None for internal_module in list(self.pm.list_modules()): if internal_module.name == module + ".dll": @@ -50,14 +54,20 @@ class Hack(): else: raise MemoryError + def find_variable(self, client, offset: int) -> int: + """Find element in memory""" + local_element = None + while not local_element: + local_element = self.pm.read_uint(client + offset) + sleep(self.timeout) + + return local_element + class Cheat(Hack): def __init__(self) -> None: super().__init__() - self.wait_time = 0.01 - self.timeout = self.wait_time * 50 - self.cheats_list = [func for func in dir(self) # Function if callable(getattr(self, func)) @@ -66,25 +76,16 @@ class Cheat(Hack): # Utils if not func.startswith("find_")] - def find_local_player(self, client) -> int: - local_player = None - while not local_player: - local_player = self.pm.read_uint( - client + self.offsets["dwLocalPlayer"]) - sleep(self.timeout) - - return local_player - def bhop(self) -> None: # Aliases mem = self.pm offset = self.offsets - # Get module address + # Get client client = self.find_module("client") - # Get local player - local_player = self.find_local_player(client) + # Get player + local_player = self.find_variable(client, offset["dwLocalPlayer"]) # Hack loop while True: