In this repository are collected tools and scripts for the game 7 Days to Die:
- Tools for the detection of objects/entities
- Scripts for the automatization of actions (mining, crafting, etc.)
- Aim bots
- Passcode cracking
- Block detection
This software can be installed as a pip
module.
py -m pip install py7dtd
python -m pip install py7dtd
There are currently three functions available:
Clone the module, create a virtual environment and install it:
git clone --recurse-submodules git@github.com:tassoneroberto/py7dtd.git
cd py7dtd
py -3.10 -m venv venv
.\venv\Scripts\Activate.ps1
py -m pip install .\iocontroller
py -m pip install .[ai]
ltt install torch torchvision
Note: if you are not interested in "entities detection" or "aimbot" then you can omit [ai]
from the above command and the ltt install torch torchvision
command:
py -m pip install .\iocontroller
py -m pip install .
To install the package in edit mode (for developers) specify -e
:
py -m pip install -e .\iocontroller
py -m pip install -e .[ai]
ltt install torch torchvision
Disclaimer: an NVIDIA® GPU card with CUDA® architectures 3.5, 3.7, 5.2, 6.0, 6.1, 7.0 or higher is required. See the list of CUDA®-enabled GPU cards (https://developer.nvidia.com/cuda-gpus).
Install the following dependencies:
- C++ redistributable (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
- NVIDIA® GPU drivers —CUDA® 11.2.1 (https://www.nvidia.com/drivers)
- CUDA® Toolkit 11.1 (https://developer.nvidia.com/cuda-toolkit-archive)
- cuDNN SDK 7.6 (https://developer.nvidia.com/cudnn)
In order to use the module you need a x64
version of Python 3.10.x
.
You can download it at this page: https://www.python.org/downloads/windows/
You also need to have a trained model for the entities detection in ./dataset/models/
and the dataset config json to in ./dataset/json/
.
You can train it yourself by following the instructions below or you can download it here:
- https://github.com/tassoneroberto/py7dtd/releases/download/v1.0.0-alpha1/yolov3_dataset_last.pt (copy to
./dataset/models/
) - https://github.com/tassoneroberto/py7dtd/releases/download/v1.0.0-alpha1/dataset_yolov3_detection_config.json (copy to
./dataset/json/
)
The dataset used to train the model has to be increased to to improve the reliability of the detection. This can be done using the open source tool labelImg
https://github.com/tzutalin/labelImg. The folder dataset
needs to have the following structure:
- train
- annotations
- classes.txt
- source1.txt
- source2.txt
- source3.txt
- ...
- images
- source1.png
- source2.png
- source3.png
- ...
- annotations
- validation
- annotations
- classes.txt
- source101.txt
- source102.txt
- source103.txt
- ...
- images
- source101.png
- source102.png
- source103.png
- ...
- annotations
Run the following command to start training the model:
py7dtd_model_training
The following table is listing all the arguments that can be specified:
arg | description | default |
---|---|---|
help | Arguments description | N/A |
dataset | Dataset folder path | ./dataset |
pretrained | Pre-trained model path | ./dataset/models/yolov3.pt |
epochs | Number of epochs to train | 200 |
- The annotation has to be in the YOLO format.
- The test set has to be a lot smaller than the size of the train set.
- The
classes.txt
are automatically generated bylabelImg
and contain the names of the objects to detect. - You can use a pre-trained model for transfer learning. To do so you have to download the file https://github.com/tassoneroberto/py7dtd/releases/download/v1.0.0-alpha1/yolov3.pt and put it in
./dataset/models
(or specify a different location with the argument--pretrained
).
❗ Under development ❗
Simple entities detector using AI (Computer Vision).
The objects detection (trees, zombies, etc.) is done using ImageAI
: https://github.com/OlafenwaMoses/ImageAI/
The annotation of the images has been done using the tool labelImg
: https://github.com/heartexlabs/labelImg/
❗ Under development ❗
Simple aim bot capable of:
- Detect zombies/players
- Move the mouse to the target
- Shoot
py7dtd_auto_shooting --delay 200
Note: Press ESC
to interrupt the bot.
The following table is listing all the arguments that can be specified:
arg | description | default |
---|---|---|
help | Arguments description | N/A |
delay | Time in ms between each screenshot | 500 |
Brute-force/dictionary attack on chests/doors passcode.
It is recommended to set the game in window mode with a resolution of 640x480.
Example of a brute-force attack testing pass codes composed of digits and lowercase characters.
Note: Press ESC
to interrupt the bot.
py7dtd_crack_passcode --brute --digits --lower
Get the arguments list with the help
function:
py7dtd_crack_passcode --help
Example of a dictionary attack with no limit in tries.
py7dtd_crack_passcode --dict
Note: dictionaries can be found at https://github.com/danielmiessler/SecLists/tree/master/Passwords.
The available methods are brute-force attack (--brute
) and dictionary attack (--dict
).
The following table is listing all the arguments to use for each method:
arg | description | default | type |
---|---|---|---|
help | Arguments description | N/A |
N/A |
min | Minimum length | 1 |
brute |
max | Maximum length | 20 |
brute |
digits | Include digits | False |
brute |
lower | Include lowercase characters | False |
brute |
upper | Include uppercase characters | False |
brute |
lowercyrillic | Include lowercase cyrillic characters | False |
brute |
uppercyrillic | Include uppercase cyrillic characters | False |
brute |
special | Include special characters | False |
brute |
allcharacters | Include all characters | False |
brute |
dictpath | Dictionary file path | ./dictionaries/top1000000.txt |
dict |
resumedict | Line number to resume a dictionary attack | 0 |
dict |
limit | Maximum number of tries | ∞ |
brute , dict |
timeout | Maximum time in seconds allowed | ∞ |
brute , dict |
delay | Delay in ms between each action | 35 |
brute , dict |
*If no characters set is selected for the brute-force method, the following sets will be automatically selected: [digits
, lower
]
Detection of blocks like topsoil
and destroyed stone
by analyzing the block's pixel color from the game map.
Export the game map into a png
file with the external tool https://github.com/DorHans/7DTD-SMR. Use the exported map as input for the blocks detections. Each pixel will be analyzed and, if an interested block is detected, it will be marked in red in the output file.
py7dtd_blocks_detection --topsoil --destroyed_stone --input .\map.png
If the argument output
is not specified, an output file will be stored in the current folder with the same name as the input file and a suffix _output
(e.g. map_output.png
).
Get the arguments list with the help
function:
py7dtd_blocks_detection --help
Example of detection of topsoil and destroyed stone blocks in the desert biome:
The following table is listing all the arguments:
arg | description | default |
---|---|---|
help | Arguments description | N/A |
input | Input filename | N/A * |
topsoil | Topsoil blocks | False ** |
dirt | Dirt blocks | False ** |
gravel | Gravel blocks | False ** |
destroyed_stone | Destroyed stone blocks | False ** |
output | Output filename | input + '_output' suffix |
*Required
**At least one of these is required
Note: topsoil
blocks and dirt
blocks appear with the same color in the map.