Skip to content

Commit

Permalink
Merge pull request #51 from Titlehhhh/dev
Browse files Browse the repository at this point in the history
Last Pull
  • Loading branch information
Titlehhhh authored Jan 11, 2024
2 parents f5f8d4e + 84f0cb5 commit 6c2930d
Show file tree
Hide file tree
Showing 119 changed files with 2,901 additions and 3,495 deletions.
118 changes: 92 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,108 @@
[![Discord Banner](https://img.shields.io/badge/discord-join%20chat-46BC99)](https://discord.gg/HVDzx4rCgg)
<h1 align="center">
<img src="https://raw.githubusercontent.com/Titlehhhh/Minecraft-Holy-Client/master/mhc.svg" alt="Minecraft Holy Client">
</h1>

*На данный момент программа находится в предварительной версии, поэтому некоторые функции нестабильны. Подробнее можно узнать [здесь](preview.md).*

# Minecraft Holy Client
<h4 align="center">A high-performance platform for running stress-testing minecraft bots.</h4>

Высокопроизводительная платформа для запуска стресс-тест ботов Minecraft, написанная на C#.
<p align="center">
<a href="https://github.com/Titlehhhh/Minecraft-Holy-Client/commits/master">
<img src="https://img.shields.io/github/last-commit/Titlehhhh/Minecraft-Holy-Client.svg?style=flat-square&logo=github&logoColor=white"
alt="GitHub last commit">
<a href="https://github.com/Titlehhhh/Minecraft-Holy-Client/issues">
<img src="https://img.shields.io/github/issues-raw/Titlehhhh/Minecraft-Holy-Client.svg?style=flat-square&logo=github&logoColor=white"
alt="GitHub issues">
<a href="https://github.com/Titlehhhh/Minecraft-Holy-Client/pulls">
<img src="https://img.shields.io/github/issues-pr-raw/Titlehhhh/Minecraft-Holy-Client.svg?style=flat-square&logo=github&logoColor=white"
alt="GitHub pull requests">
<a href="https://discord.gg/HVDzx4rCgg">
<img src="https://img.shields.io/badge/discord-join%20chat-46BC99"
alt="Discord">
<a href="https://github.com/Titlehhhh/Minecraft-Holy-Client/releases">
<img src="https://img.shields.io/github/downloads/Titlehhhh/Minecraft-Holy-Client/total.svg"
alt="Download">

## Get Started
</p>

[Скачайте в релизах](https://github.com/Titlehhhh/Minecraft-Holy-Client/releases) последнюю версию Minecraft Holy Client и запустите её.

После запуска приложения Вас встретит окно с главной страницей.
![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/4d582c49-13bd-44c7-81b4-f6ebd5b924cd)
<p align="center">
<a href="#installation">Installation</a> •
<a href="#launch">Launch</a> •
<a href="#features">Features</a> •
<a href="#contributing">Contributing</a> •
<a href="#support">Custom plugin</a> •
<a href="#license">License</a>
</p>

После открытия навигационного меню Вы увидите несколько пунктов:
- Главная. Страница где есть основная информация о приложении: GitHub, Наш Discord сервер, а также документация(в разрботке).
- Бот менеджер. Эта экспериментальная функция. Планируется в программу добавить простых ботов, таких как, боты афк-рыбалки или подобные.
- Настройки. Вы можете настроить язык. Пока можно настроить только это.
- Стресс-тест. Основная возможность приложения. Здесь Вы можете протестировать Ваш сервер под высокой нагрузкой.
- Управление расширениями. Здесь Вы можете добавить свои плагины в программу.
![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/3a156e06-bd3c-4882-9c5c-ce123c14b9c2)
---

### Запуск стресс-теста

1) Перейдем на страницу Стресс-тест и введем Ip адрес сервера, который мы хотим нагрузить.
2) Далее поставить префикс ника для ботов. Пусть будет "Title_"
3) Затем укажем количество ботов. Это количество, которое система будет стремиться запустить. Например 1000.
4) Укажем, что нужно в тестировании использовать прокси сервера, а также укажем версию 1.16.5.
5) В настройках поведения укажем, чтобы боты спамили "Hello from Minecraft Holy Client".
![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/fdbab77e-0eed-44ed-bbe3-30e6d100802b)
<table>
<tr>
<td>

Нажимаем на зеленую кнопку видим, что боты зашли на сервер и спамят "Hello from Minecraft Holy Client"
![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/51c89585-1fd5-4351-9677-a59322ececd7)
**Minecraft Holy Client** is a handy, **high-performance**, easily extensible **open-source** application designed to run load and stress-test **Minecraft** bots, written in C#.

All components of the application have been designed to **maximize performance**, so it works stably on **weak devices**.

## Roadmap

![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/cee54a39-b6e5-4e10-b329-ec0230eb43b4)
![Minecraft Holy Client Bots](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/75c9f0a3-8ae2-4b7c-8ad5-e8b5fa120165)
<p align="right">
<sub>(Preview 300~ bots)</sub>
</p>

</td>
</tr>
</table>

## Installation

Minecraft Holy Client is available for **Windows**, **Linux** and **MacOs**. In addition, it is **portable** and is not installed on the system, so it can be easily uninstalled.

[Download](https://github.com/Titlehhhh/Minecraft-Holy-Client/releases) the latest version of HolyClient.Desktop and follow these instructions depending on your platform.

### Windows

1) Open and _extract_ the archive with the program.
2) Run **HolyClient.Desktop.exe**

### Linux

_Using Ubuntu as an example_

1) Open and _extract_ the archive with the program.
2) Open a terminal where the HolyClient.Desktop file is located and execute `./HolyClient.Desktop` in the console

### Mac Os

1) Open and _extract_ the archive with the program.
2) Open a terminal where the HolyClient.Desktop file is located and execute `./HolyClient.Desktop` in the console


## Launch

When we have launched the app, then we can safely go to the "Stress Test" tab and we can launch bots.



![image](https://github.com/Titlehhhh/Minecraft-Holy-Client/assets/93156853/55769ef1-f81d-477d-9027-02dfa0339f80)


## Features

- **Custom proxies**. It is possible to load custom proxies from a link and a file.
- **Multiverse in bots**. Bots can enter servers from 1.12.2 to 1.19.3. Temporarily not all packets are supported, this is being actively worked on.
- **Using user behavior for stress testing**.

## Contributing

Contributions are always welcome!

## Custom plugin

The default plugin has few features. It just sends `/register <pass> <pass>` first and starts spamming immediately.
Minecraft servers are a large number, with different anti-bot systems and if you want to test your server for bot attacks, it makes sense to write a custom plugin that would bypass it. How to write custom plugins is written here.



Expand Down
2 changes: 1 addition & 1 deletion ReleaseNotes/2.0.0-preview.1/En.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
> [!WARNING]
> Disclaimer: This translation was generated using AI.
# What's New in Minecraft Holy Client *2.0.0-preview.1*?
# What's New in Minecraft Holy Client **2.0.0-preview.1.1**?

## Major Fixes

Expand Down
2 changes: 1 addition & 1 deletion ReleaseNotes/2.0.0-preview.1/Ru.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Что изменилось в Minecraft Holy Client *2.0.0-preview.1*?
# Что изменилось в Minecraft Holy Client **2.0.0-preview.1.1**?

## Основные исправления

Expand Down
Empty file.
2 changes: 2 additions & 0 deletions ReleaseNotes/2.0.0-preview.2/Ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- memory performance
- default plugin /reg to /register
2 changes: 1 addition & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<PackageReference Include="Nuke.Common" Version="7.0.6" />

<PackageReference Include="Octokit" Version="9.0.0" />
<PackageReference Include="Octokit" Version="9.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 3 additions & 7 deletions preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@

Этот раздел может меняться в течение разработки. Все изменения будут написаны в заметках о выпуске предварительной версии.

# Функции, которые нужно добавить

## Плагины
- Плагин, который будет установлен в программу по умолчанию. Это упростит использование программой простым пользователям.
# Плагины
- Возможность перезагружать плагины из менеджера расширений, а также из вкладки "Поведения".
- Возможность загружать плагины из NuGet.
- Отображение ошибки, если плагин не найден.
- Отображение ошибки, если поведение не найдено.

## Прокси
- Прокси по умолчанию.
- Возможность загружать прокси из URL источников, например, из открытых репозиториех GitHub с бесплатными списками прокси.
# Прокси
- Возможность загружать прокси с логином и паролем.
- Отображение количества загруженных прокси в окне с запуском стресс теста.
- Возможность загружать разные типы прокси(HTTP(S), Socks(4/5)) из одного источника.

## Прочее
# Прочее
- Система профилей в стресс тесте.

Binary file added roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace HolyClient.Abstractions.StressTest
public interface IStressTestBot
{
public Task Restart(bool changeNickAndProxy);
IObservable<Exception> OnError { get; }


public MinecraftClient Client { get; }
}
Expand Down
4 changes: 2 additions & 2 deletions src/CoreLibs/HolyClient.Common/HolyClient.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" />
<PackageReference Include="MessagePack" Version="2.6.100-alpha" />
<PackageReference Include="Polly" Version="8.2.0" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.31" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.39" />
<PackageReference Include="Serilog" Version="3.1.2-dev-02097" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="QuickProxyNet" Version="0.1.4" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/CoreLibs/HolyClient.Core/Helpers/MapDataHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static Image<Rgba32> CreateImage(byte[] colors)

var color = new Rgba32(values[0], values[1], values[2]);

//Console.WriteLine(color.Name);

image[y, x] = color;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/CoreLibs/HolyClient.Core/HolyClient.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" />
<PackageReference Include="MessagePack" Version="2.6.100-alpha" />
<PackageReference Include="Polly" Version="8.2.0" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.31" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.39" />
<PackageReference Include="Serilog" Version="3.1.2-dev-02097" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="SixLabors.Fonts" Version="2.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task Run(ILogger logger, CancellationToken cancellation)

Interlocked.Exchange(ref _cleanUpPlugins, disposables);

await minecraftClient.Login(logger);
await minecraftClient.Start(logger);
}
public Task Stop()
{
Expand Down
95 changes: 75 additions & 20 deletions src/CoreLibs/HolyClient.StressTest/DefaultBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ public class DefaultBehavior : IStressTestBehavior

[System.ComponentModel.DisplayName("Spam timeout")]
public int SpamTimeout { get; set; } = 5000;
[System.ComponentModel.DisplayName("Reconnect timeout")]
public int ReconnectTimeout { get; set; } = 5000;

[System.ComponentModel.DisplayName("Reconnect timeout")]
public int Reconnects { get; set; } = 1;

[System.ComponentModel.DisplayName("Spam Nocom")]
public bool SpamNocom { get; set; } = false;

private static Regex SayVerifyRegex = new(@"\.say \/verify (\d+)");

Expand All @@ -23,9 +30,9 @@ public Task Activate(CompositeDisposable disposables, IEnumerable<IStressTestBot
{
CancellationTokenSource cts = null;

var d = bot.OnError.Subscribe(async x =>
{

Action<Exception> onErr = async (exc) =>
{
try
{
if (cts is not null)
Expand All @@ -43,13 +50,35 @@ public Task Activate(CompositeDisposable disposables, IEnumerable<IStressTestBot
{
cts = null;
}
if (Reconnects <= 0)
{
await bot.Restart(true);
}
else
{

await Task.Delay(1500);
await bot.Restart(true);
for (int i = 0; i < Reconnects-1; i++)
{
if (ReconnectTimeout <= 0)
await Task.Delay(1000);
else
await Task.Delay(ReconnectTimeout);

});

disposables.Add(d);

await bot.Restart(false);
}
await bot.Restart(true);
}
};

bot.Client.OnErrored += onErr;


disposables.Add(Disposable.Create(() =>
{
bot.Client.OnErrored -= onErr;
}));

var d2 = bot.Client.OnJoinGame.Subscribe(async x =>
{
Expand All @@ -60,12 +89,12 @@ public Task Activate(CompositeDisposable disposables, IEnumerable<IStressTestBot

await Task.Delay(500);

await bot.Client.SendChat("/reg 21qwerty 21qwerty");
await bot.Client.SendChat("/register 21qwerty 21qwerty");

try
{
using CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
//{


var m = await bot.Client.OnChatMessage
.Where(x => x.Message.Contains("verify"))
Expand All @@ -76,29 +105,25 @@ public Task Activate(CompositeDisposable disposables, IEnumerable<IStressTestBot
var code = SayVerifyRegex.Match(m.Message).Value;

await bot.Client.SendChat(code);
//}

}
catch (Exception ex)
{
//Console.WriteLine(ex);
}

while (!cts.IsCancellationRequested)
{
await bot.Client.SendChat(SpamText);
if (SpamTimeout <= 0)
await Task.Delay(1000);
else
await Task.Delay(SpamTimeout);
}

var spamming = SpamMessage(cts, bot);
var nuker = SpamNocomAsync(cts, bot);

await Task.WhenAll(spamming, nuker);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);

}
finally
{
Console.WriteLine("cancel");

}
});

Expand All @@ -109,6 +134,36 @@ public Task Activate(CompositeDisposable disposables, IEnumerable<IStressTestBot
}
return Task.CompletedTask;
}
private async Task SpamMessage(CancellationTokenSource cts, IStressTestBot bot)
{
while (!cts.IsCancellationRequested)
{
await bot.Client.SendChat(SpamText);
if (SpamTimeout <= 0)
await Task.Delay(1000);
else
await Task.Delay(SpamTimeout);
}
}
private async Task SpamNocomAsync(CancellationTokenSource cts, IStressTestBot bot)
{
if (!SpamNocom)
return;
while (!cts.IsCancellationRequested)
{

await Task.Delay(100);

await bot.Client.SendAction(0,
new McProtoNet.Vector3(
Random.Shared.Next(0, 10000),
Random.Shared.Next(0, 255),
Random.Shared.Next(0, 10000)),
McProtoNet.Core.BlockFace.DOWN);


}
}
}

}
Loading

0 comments on commit 6c2930d

Please sign in to comment.