This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New sniper that supports multi accounts
- Loading branch information
1 parent
7d5c6ba
commit 8b7a270
Showing
5 changed files
with
171 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
Oops, something went wrong.