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

Commit

Permalink
New sniper that supports multi accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
tropicbliss committed Sep 1, 2021
1 parent 7d5c6ba commit 8b7a270
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 209 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "buckshot"
version = "3.0.3"
version = "4.0.0"
authors = ["tropicbliss <tropicbliss@protonmail.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -11,7 +11,6 @@ anyhow = "1.0"
chrono = "0.4"
console = "0.14"
dialoguer = "0.8"
indicatif = "0.16"
native-tls = "0.2"
reqwest = { version = "0.11", features = ["blocking", "json", "multipart"] }
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -20,3 +19,7 @@ structopt = "0.3"
tokio = { version = "1.10", features = ["fs", "rt-multi-thread", "macros"] }
tokio-native-tls = "0.3"
toml = "0.5"

[profile.release]
lto = true
codegen-units = 1
80 changes: 21 additions & 59 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,75 +1,37 @@
use anyhow::{bail, Result};
use anyhow::Result;
use serde::Deserialize;
use std::fs::{read_to_string, write};
use std::io::ErrorKind::NotFound;
use std::path::Path;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};

#[derive(Deserialize)]
pub struct Config {
pub account: Account,
pub config: Others,
}

#[derive(Deserialize)]
pub struct Account {
pub email: String,
pub password: String,
pub sq_ans: [String; 3],
}

#[derive(Deserialize)]
pub struct Others {
pub accounts: Vec<Account>,
pub offset: i64,
pub auto_offset: bool,
pub spread: usize,
pub microsoft_auth: bool,
pub gc_snipe: bool,
pub change_skin: bool,
pub skin: Option<Skin>,
pub name_queue: Option<Vec<String>>,
}

#[derive(Deserialize)]
pub struct Skin {
pub skin_model: String,
pub skin_path: String,
pub name_queue: Vec<String>,
pub skin_path: PathBuf,
}

#[derive(Deserialize)]
pub struct Account {
pub email: String,
pub password: String,
pub sq_ans: Option<[String; 3]>,
}

impl Config {
pub fn new(config_path: &Path) -> Result<Self> {
match read_to_string(&config_path) {
Ok(s) => {
let config: Self = toml::from_str(&s)?;
Ok(config)
}
Err(e) if e.kind() == NotFound => {
write(&config_path, get_default_config().as_bytes())?;
bail!(
"{} not found, creating a new config file",
config_path.display()
);
}
Err(e) => bail!(e),
}
let s = read_to_string(&config_path)?;
let config: Self = toml::from_str(&s)?;
Ok(config)
}
}

fn get_default_config() -> String {
r#"[account]
email = "test@example.com"
password = "123456789"
# Leave the strings in this array empty if your Minecraft account does not have security questions
sq_ans = ["Foo", "Bar", "Baz"]
[config]
offset = 0
auto_offset = false
# Spread (delay in milliseconds between each snipe request, not to be confused with offset which is the number of millseconds in which the sniper sends its first request before the name drops)
spread = 0
microsoft_auth = false
gc_snipe = false
change_skin = false
skin_model = "slim"
skin_path = "example.png"
# Name queueing (allows you to queue up multiple names for sniping)
# Note: This is an optional feature, leave this array empty if you prefer to enter your name manually via an input prompt)
name_queue = []
"#
.to_string()
}
Loading

0 comments on commit 8b7a270

Please sign in to comment.