From d6d3723876bd74029395fd92c4cc6cbee8eb5083 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 1 Apr 2023 16:11:56 +0200 Subject: [PATCH] Add CLI interface --- README.md | 17 ++++++++++++ cheat.py | 6 ++-- cheats/aimbot.py | 4 +-- cheats/bhop.py | 4 +-- cheats/chams.py | 4 +-- cheats/fov.py | 4 +-- cheats/glow.py | 4 +-- cheats/noflash.py | 4 +-- cheats/norecoil.py | 4 +-- cheats/radarhack.py | 4 +-- cheats/trigger.py | 4 +-- hack.py | 4 +-- main.py | 67 +++++++++++++++++++++++++++------------------ 13 files changed, 81 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 83bae00..dab845e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,23 @@ pip install -r .\requirements.txt python .\main.py ``` +### Extra info + +- You can use a local file for offsets (see [this documentation](./hazedumper/README.md) + to generate the `.json` file) by passing `--offline` to the app: + +```powershell +python .\main.py --offline +``` + +- You also can bypass the interactive cheat selector by passing a list to the app. + +For example, for cheat `#1`, `#2`, `#3` and `#4`: + +```powershell +python .\main.py --list=1,2,3,4 +``` + ## How to not use? **CTRL + C** will stop the app. diff --git a/cheat.py b/cheat.py index 1146d79..e3baadc 100644 --- a/cheat.py +++ b/cheat.py @@ -13,8 +13,10 @@ class Cheat(Bhop, Radarhack, Glow, Trigger, Norecoil, Noflash, Chams, Aimbot, Fov, ): - def __init__(self) -> None: - super().__init__() + """All cheats are loaded in this class""" + + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) self.cheats_list = [func for func in dir(self) # Function diff --git a/cheats/aimbot.py b/cheats/aimbot.py index cbe72ce..4067e93 100644 --- a/cheats/aimbot.py +++ b/cheats/aimbot.py @@ -5,8 +5,8 @@ from utils import Vec, angle_fixer, hypot class Aimbot(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) # AimBot FOV, higher = more aggressive self.__fov_range = 5. diff --git a/cheats/bhop.py b/cheats/bhop.py index ee003ce..2e8b2fc 100644 --- a/cheats/bhop.py +++ b/cheats/bhop.py @@ -4,8 +4,8 @@ from hack import Hack, sleep class Bhop(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) def bhop(self) -> None: # Aliases diff --git a/cheats/chams.py b/cheats/chams.py index 4cc90e2..6b650db 100644 --- a/cheats/chams.py +++ b/cheats/chams.py @@ -5,8 +5,8 @@ from utils import Color3i class Chams(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) self.__color = Color3i(255, 255, 0) diff --git a/cheats/fov.py b/cheats/fov.py index 059e74c..f3c520d 100644 --- a/cheats/fov.py +++ b/cheats/fov.py @@ -4,8 +4,8 @@ from hack import Hack class Fov(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) self.__fov = None self.__factor = 5 diff --git a/cheats/glow.py b/cheats/glow.py index f479772..9561212 100644 --- a/cheats/glow.py +++ b/cheats/glow.py @@ -3,8 +3,8 @@ from utils import Color4f class Glow(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) self.__color = Color4f(1., 0., 0., .8) diff --git a/cheats/noflash.py b/cheats/noflash.py index 1d6ce12..e52bcca 100644 --- a/cheats/noflash.py +++ b/cheats/noflash.py @@ -2,8 +2,8 @@ from hack import Hack, sleep class Noflash(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) self.__brightness = 30. diff --git a/cheats/norecoil.py b/cheats/norecoil.py index 5d2f1a7..0d476a5 100644 --- a/cheats/norecoil.py +++ b/cheats/norecoil.py @@ -3,8 +3,8 @@ from utils import Vec, angle_fixer class Norecoil(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) # Control variable self.nr__old_punch = Vec() diff --git a/cheats/radarhack.py b/cheats/radarhack.py index 8225c86..bd9bb92 100644 --- a/cheats/radarhack.py +++ b/cheats/radarhack.py @@ -2,8 +2,8 @@ from hack import Hack class Radarhack(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) def radar_hack(self) -> None: # Aliases diff --git a/cheats/trigger.py b/cheats/trigger.py index ef61feb..8d072a8 100644 --- a/cheats/trigger.py +++ b/cheats/trigger.py @@ -4,8 +4,8 @@ from hack import Hack, sleep class Trigger(Hack): - def __init__(self) -> None: - super().__init__() + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) def trigger(self) -> None: # Aliases diff --git a/hack.py b/hack.py index d7dba8a..a1931d9 100644 --- a/hack.py +++ b/hack.py @@ -8,9 +8,9 @@ from requests import get class Hack(): """Base class for playing with CSGO memory""" - def __init__(self) -> None: + def __init__(self, offline: bool = False) -> None: # Loading offsets - self.offsets = self._find_offsets() + self.offsets = self._find_offsets(offline) self.vmap = self._find_keys() self.pm = self._find_process(True) diff --git a/main.py b/main.py index 913e2b6..729edce 100644 --- a/main.py +++ b/main.py @@ -1,37 +1,50 @@ +from sys import argv from threading import Thread from cheat import Cheat, sleep if __name__ == "__main__": - # Cheat - c = Cheat() + c_id = [] + args = {} - # Cheat list - print("Enter 0 to exit.") - print("You can run multiples cheat at once, separate your choices with a space.") - print("Available cheats:") - for idx, cheat in enumerate(c.cheats_list): - print(f"#{idx + 1} - {cheat}") + if (len(argv) > 1): + # User wanna use offline offsets + if "--offline" in argv: + args["offline"] = True - # Select cheat - c_id = None - while c_id == None: - try: - response = [int(i) for i in input("Enter ID: ").split(" ")] - c_id = [] - for i in response: - match i: - case 0: - exit(0) - case j if j > len(c.cheats_list): - raise IndexError - case _: - c_id.append(i - 1) - except KeyboardInterrupt: - print("??\nBye.") - exit(1) - except: - print("Invalid ID.") + # User gave a list of cheats + # Will bypass the interactive selection + c_id = [int(j) for j in [i for i in argv if i.startswith( + "--list=")][0][7:].split(",")] + + # Load cheat class + c = Cheat(**args) + + # Interactive selection + if (c_id == []): + # Cheat list + print("Enter 0 to exit.") + print("You can run multiples cheat at once, separate your choices with a space.") + print("Available cheats:") + for idx, cheat in enumerate(c.cheats_list): + print(f"#{idx + 1} - {cheat}") + + while c_id == []: + try: + response = [int(i) for i in input("Enter ID: ").split(" ")] + for i in response: + match i: + case 0: + exit(0) + case j if j > len(c.cheats_list): + raise IndexError + case _: + c_id.append(i - 1) + except KeyboardInterrupt: + print("??\nBye.") + exit(1) + except: + print("Invalid ID.") # Instanciate and run threads for fn in [c.cheats_list[i] for i in c_id]: