Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Awoodwhale committed Jan 20, 2023
0 parents commit 1ee572c
Show file tree
Hide file tree
Showing 54 changed files with 3,869 additions and 0 deletions.
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<h1 align="center">Welcome to Goose_Goose_Duck_Hack_Py 🐋</h1>
<p>
</p>


> 一个使用Python编写的Goose Goose Duck Cheat。
>
> 内存操作使用[pymem](https://github.com/srounet/Pymem),GUI界面使用[pywebview](https://github.com/r0x0r/pywebview)
## Install

```sh
pip3 install -m requirements.txt
```

## Usage

使用如下命令默认开启GUI模式

```sh
python3 main.py
```

**修改功能**

- 移速修改
- 穿墙修改
- cd修改
- 迷雾修改

![GUI](img/gui.png)

![wall_before](img/wall_before.gif)

![wall_after](img/wall_after.gif)

![fog_before](img/fog_before.png)

![fog_after](img/fog_after.png)

**游戏地图**

- 选择地图
- 玩家位置
- 左键地图进行传送

![map](img/map.png)

![tp](img/tp.gif)

**玩家信息**

- 查看玩家部分状态

![map](img/players.png)



若不想启用GUI,也可以使用**命令模式**进行修改,使用如下代码查看更多帮助信息。命令功能使用[click](https://github.com/pallets/click)完成。

```sh
python3 main.py --help
```

```sh
Usage: main.py [OPTIONS]

Options:
--gui BOOLEAN Whether to open GUI window
--windows INTEGER Number of GUI windows
--log BOOLEAN Need to view log information
--speed FLOAT Hack the player's current movement speed
--wall BOOLEAN Hack the player's cross the wall status
--fog BOOLEAN Hack the player's the fog of war
--cd BOOLEAN Hack the player's cooling state
--showinfo INTEGER Display information of the target player
--help Show this message and exit.
```
## Q&A

**Q: 找不到游戏进程**

A: 请确保游戏开启并使用管理员权限执行Python命令

**Q: 地图首次渲染失败**

A: 点击地图界面的刷新数据或者点击右上角的刷新



*更多出现的BUG或者建议可以提在issue中!*

## Author

**woodwhale**

* Website: https://www.woodwhale.top/
* Github: [@Awoodwhale](https://github.com/Awoodwhale)

## Show your support

Give a ⭐️ if this project helped you!

## Reference

[Liuhaixv's Goose_Goose_Duck_Hack](https://github.com/Liuhaixv/Goose_Goose_Duck_Hack/)
160 changes: 160 additions & 0 deletions backend/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
from typing import List
from pymem.process import process_from_id
from backend.classes.hack import Hack
from backend.classes.memory import Memory
from backend.classes.client import Client
from backend.classes.data_updater import DataUpdater
from backend.utils.utils import Singleton

@Singleton
class Api:
ready: bool = False

def __init__(self) -> None:
self.ready = self.init_memory() # api准备就绪

def init_memory(self) -> bool:
"""初始化memory
:return: 是否初始化成功
:rtype: bool
"""
memory = Memory() # 初始化游戏内存
if memory.init():
self.memory = memory
self.client = Client(self.memory)
self.hack = Hack(self.client)
self.data_updater = DataUpdater(self.client)
self.ready = True
return True
return False

def is_game_process_open(self) -> bool:
"""判断游戏进程是否开启
:return: 是否开启游戏进程
:rtype: bool
"""
if self.ready:
if process_from_id(self.memory.pid):
return True
self.ready = False
return False
return self.init_memory()

def is_game_start(self) -> bool:
"""判断局内游戏是否开始
:return: 局内游戏是否开始
:rtype: bool
"""
if self.is_game_process_open():
return self.client.local_player.player_controller.b_isPlayerRoleSet
return False

def update_players(self):
"""
更新玩家信息
前端开启一个线程, 不断地执行这个函数
"""
if not self.is_game_process_open():
raise # 没开启游戏就产生异常
self.data_updater.player_controller_updater()

def hack_speed(self, target_speed: float) -> bool:
"""调用hack对象的函数去修改本地玩家的速度
:param target_speed: 目标速度
:type target_speed: float
:return: 是否修改成功
:rtype: bool
"""
return self.hack.speed_hack(target_speed)

def hack_wall(self, target_state: bool) -> bool:
"""调用hack对象的函数去修改本地玩家穿墙的能力
:param target_state: 是否开启穿墙
:type target_state: bool
:return: 是否修改成功
:rtype: bool
"""
return self.hack.wall_hack(target_state)

def hack_fog(self, target_state: bool) -> bool:
"""调用hack对象的函数去修改本地玩家超远视距, 移除迷雾
:param target_state: 是否开启
:type target_state: bool
:return: 是否修改成功
:rtype: bool
"""
return self.hack.fog_hack(target_state)

def hack_cooldown(self, target_state: bool) -> bool:
"""调用hack对象的函数将本地玩家的cd清零
:param target_state: 是否开启无cd
:type target_state: bool
:return: 是否修改成功
:rtype: bool
"""
return self.hack.skill_cooldown_hack(target_state)

def hack_position(self, v2_pos: List[float]) -> bool:
"""调用hack对象的函数将本地玩家传送到一个二维坐标
:param v2_pos: 二维坐标
:type v2_pos: List[float]
:return: 是否修改成功
:rtype: bool
"""
return self.hack.tp_hack(v2_pos)

def get_cur_speed(self) -> float:
"""获取当前本地用户的速度
:return: 速度
:rtype: float
"""
return self.client.local_player.get_movement_speed()

def get_cur_fog_distance(self) -> float:
"""获取当前本地用户的迷雾视距
:return: 迷雾视距
:rtype: float
"""
return self.client.local_player.get_fog_distance()

def get_cur_enable_xray(self) -> bool:
"""获取当前是否开启了透视
:return: 是否开启了透视
:rtype: bool
"""
return self.client.local_player.get_enable_xray()

def get_cur_enable_wall(self) -> bool:
"""获取当前是否开启了穿墙
:return: 是否开启了穿墙
:rtype: bool
"""
return self.client.local_player.get_enable_wall()

def get_cur_enable_cd(self) -> bool:
"""获取当前是否开启了无cd
:return: 是否开启了无cd
:rtype: bool
"""
return self.client.local_player.get_enable_cd()

def get_players_info(self) -> list:
"""返回16个玩家信息
:return: 16个玩家信息
:rtype: list
"""
return [str(x) for x in self.client.player_controllers]
Loading

0 comments on commit 1ee572c

Please sign in to comment.