Compare commits

..

7 Commits

Author SHA1 Message Date
Alexander Medvedev
8d3619f838 add one more option 2026-08-28 11:57:18 +02:00
Alexander Medvedev
85ff0f4e28 fix it finally 2026-08-19 09:52:50 +02:00
Alexander Medvedev
0e4faf82d6 some fixes 2026-08-18 13:45:05 +02:00
Alexander Medvedev
253ad6f336 fix: build 2026-08-17 19:06:18 +02:00
Alexander Medvedev
4f493976ea Port 26.2 2026-06-25 14:01:53 +02:00
Alexander Medvedev
a7296b4522 update to 26.1 2026-04-19 21:28:35 +02:00
Alexander Medvedev
e4fa37f2c9 feat: random head rotation & swing 2026-01-31 15:42:48 +01:00
6 changed files with 2327 additions and 721 deletions

View File

@ -17,7 +17,7 @@ jobs:
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
@ -29,7 +29,7 @@ jobs:
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features
@ -42,7 +42,7 @@ jobs:
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --verbose

1300
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "botmark"
version = "0.1.0"
version = "0.1.1"
edition = "2024"
[profile.release]
@ -10,15 +10,21 @@ codegen-units = 1
[dependencies]
# log
log = "0.4"
simple_logger = "5.1.0"
simple_logger = "5.2.0"
# CLI
clap = { version = "4.5.54", features = ["derive"] }
clap = { version = "4.6.6", features = ["derive"] }
# Networking
tokio = { version = "1.49.0", features = ["net", "io-util"] }
tokio = { version = "1.53.1", features = ["net", "io-util"] }
pumpkin-protocol = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-protocol", default-features = false, features = ["serverbound", "clientbound"]}
pumpkin-util = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-util"}
pumpkin-data = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-data"}
crossbeam = "0.8.4"
uuid = "1.19.0"
uuid = "1.25.0"
rand = { git = "https://github.com/rust-random/rand"}
rsa = { version = "=0.10.0-rc.18", default-features = false, features = ["std", "encoding"] }
[patch."https://github.com/Pumpkin-MC/Pumpkin"]
pumpkin-protocol = { path = "../Pumpkin/crates/pumpkin-protocol" }
pumpkin-util = { path = "../Pumpkin/crates/pumpkin-util" }
pumpkin-data = { path = "../Pumpkin/crates/pumpkin-data" }

View File

@ -1,7 +1,7 @@
<div align="center">
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Current version)](https://img.shields.io/badge/current_version-1.21.11-blue)
![Current version)](https://img.shields.io/badge/current_version-1.26-blue)
A tool to stress test Minecraft servers by simulating numerous bot connections, helping identify performance bottlenecks and stability issues.
![Screenshot_20250223_154536](https://github.com/user-attachments/assets/b1379060-e375-44dc-95a3-91f1f2fb52dd)
@ -39,10 +39,32 @@ Here's a detailed breakdown of all available command-line arguments:
- The timeout (in milliseconds) for each bot connection.
- Example: `--delay 500` (500 milliseconds delay)
- **`--spam_message "<message>"` (Optional):**
- **`--enable_spam_message <false/true>` (Optional, Default: `true`):**
- Enable periodic chat spam messages.
- Example: `--enable_spam_message true`
- **`--spam_message "<message>"` (Optional, Default: `Please do not spam!`):**
- Will send a Chat message with the specified `spam_message_delay`.
- Example: `--spam_message "Hello, I'm a Robot"`
- **`--spam_message_delay <delay>` (Optional, Default: `210`):**
- The delay (in milliseconds) between spam message.
- Example: `--spam_message_delay 100` (100 milliseconds delay)
- **`--spam_message_delay_min <delay>` (Optional, Default: `150`):**
- The minimal delay (in milliseconds) between spam message.
- Example: `--spam_message_delay_min 100` (100 milliseconds delay)
- **`--spam_message_delay_max <delay>` (Optional, Default: `250`):**
- The maximal delay (in milliseconds) between spam message.
- Example: `--spam_message_delay_max 250` (250 milliseconds delay)
- **`--enable_rotation <false/true>` (Optional, Default: `true`):**
- Enable random head rotations.
- Example: `--enable_rotation true`
- **`--enable_swing <false/true>` (Optional, Default: `true`):**
- Enable random arm swings.
- Example: `--enable_swing true`
- **`--enable_movement <false/true>` (Optional, Default: `true`):**
- Enable random bot movement and walking.
- Example: `--enable_movement true`
- **`--enable_jumping <false/true>` (Optional, Default: `true`):**
- Enable jumping while moving.
- Example: `--enable_jumping true`
- **`--enable_physics <false/true>` (Optional, Default: `true`):**
- Enable physics simulation (gravity, friction, inertia, server knockback).
- Example: `--enable_physics true`

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
use std::{net::SocketAddr, sync::Arc, thread::sleep, time::Duration};
use std::{net::SocketAddr, sync::Arc, sync::atomic::Ordering, time::Duration};
use clap::Parser;
use client::Client;
@ -17,31 +17,47 @@ pub struct Args {
pub delay: u64,
#[arg(short, long, default_value_t = 5000)]
pub timeout: u64,
#[arg(long)]
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_spam_message")]
pub enable_spam_message: bool,
#[arg(long, default_value = "Please do not spam!", alias = "spam_message")]
pub spam_message: Option<String>,
#[arg(long, default_value_t = 210)]
pub spam_message_delay: u32,
#[arg(long, default_value_t = 150, alias = "spam_message_delay_min")]
pub spam_message_delay_min: u32,
#[arg(long, default_value_t = 250, alias = "spam_message_delay_max")]
pub spam_message_delay_max: u32,
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_rotation")]
pub enable_rotation: bool,
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_swing")]
pub enable_swing: bool,
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_movement")]
pub enable_movement: bool,
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_jumping")]
pub enable_jumping: bool,
#[arg(long, default_value_t = true, default_missing_value = "true", num_args = 0..=1, action = clap::ArgAction::Set, alias = "enable_physics")]
pub enable_physics: bool,
}
#[tokio::main]
async fn main() {
simple_logger::init_with_level(log::Level::Info).unwrap();
let args = Args::parse();
let args = Arc::new(Args::parse());
let address = args.ip.parse::<SocketAddr>().unwrap();
let bot_count = args.count;
log::info!(
"{} Bots will Join {} with a delay of {}ms",
args.count,
bot_count,
address,
args.delay
);
let mut join_handles = Vec::with_capacity(args.count as usize);
for i in 0..args.count {
sleep(Duration::from_millis(args.delay));
let stream_result = timeout(
Duration::from_millis(args.timeout),
TcpStream::connect(address),
)
.await;
let timeout_dur = Duration::from_millis(args.timeout);
let timeout_delay = Duration::from_millis(args.delay);
let mut join_handles = Vec::with_capacity(bot_count as usize);
for i in 0..bot_count {
tokio::time::sleep(timeout_delay).await;
let stream_result = timeout(timeout_dur, TcpStream::connect(address)).await;
let stream = match stream_result {
Ok(Ok(s)) => s,
@ -60,19 +76,29 @@ async fn main() {
}
};
let client = Arc::new(Client::new(stream));
let message = Arc::new(args.spam_message.clone());
client.join_server(address, format!("BOT_{i}")).await;
let join_handle = tokio::spawn(async move {
loop {
if !client.process_packets().await {
break;
}
client.tick(message.clone(), args.spam_message_delay).await;
let cloned_args = args.clone();
let client_tick = client.clone();
let tick_handle = tokio::spawn(async move {
let mut tick_interval = tokio::time::interval(Duration::from_millis(50));
tick_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
while !client_tick.closed.load(Ordering::Relaxed) {
tick_interval.tick().await;
client_tick.tick(&cloned_args).await;
}
});
join_handles.push(join_handle);
log::info!("{}/{} Bots Joined", i + 1, args.count);
let client_proc = client.clone();
let proc_handle = tokio::spawn(async move {
while client_proc.process_packets().await {
// Keep reading and processing incoming packets without cancellation
}
});
join_handles.push(tick_handle);
join_handles.push(proc_handle);
log::info!("{}/{} Bots Joined", i + 1, bot_count);
}
// Graceful shutdown on Ctrl+C
tokio::signal::ctrl_c().await.unwrap();