Add CLI interface

This commit is contained in:
Mylloon 2023-04-01 16:11:56 +02:00
parent 5fef5b8c55
commit d6d3723876
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
13 changed files with 81 additions and 49 deletions

View file

@ -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.

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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.

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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)

67
main.py
View file

@ -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]: