fix invade nick collisions to leet

This commit is contained in:
legitnull 2023-03-17 22:24:06 -06:00
parent eaea7f6c3a
commit df3c5be437
2 changed files with 8 additions and 5 deletions

View File

@ -18,7 +18,7 @@ colored = "2"
tokio-socks = "0.5.1"
socks = "0.3.4"
random_word = "0.3.0"
#leetspeak = "0.2.0"
leetspeak = "0.2.0"
irc = "0.15.0"
futures = "0.3.27"
futures-util = "0.3.27"

View File

@ -6,6 +6,7 @@ use openssl::ssl::{SslConnector, SslMethod};
use serde::Deserialize;
use toml::{Value, to_string};
use colored::*;
use leetspeak;
//use anyhow::Result;
//use socks5_proxy::{client, Addr};
@ -20,10 +21,6 @@ struct Config {
//invaders: Vec<String>,
server: String,
port: u16,
proxy_server: String,
proxy_port: u16,
}
pub struct InvadeCommand;
@ -50,6 +47,7 @@ impl Command for InvadeCommand {
let config_clone = config.clone();
let screaming = scream.to_string();
let command_channel = channel.to_string();
let thread_invader = random_word::gen(); // change to leetspeak on nick collision
std::thread::spawn(move || {
@ -88,6 +86,11 @@ impl Command for InvadeCommand {
println!("{} {}","[%] PONG:".bold().green(), thread_invader.blue());
ssl_stream.write_all(response.as_bytes()).unwrap();
}
if message.starts_with("433") { // Numeric reply for nickname in use
let leet_nick = leetspeak::translate(&thread_invader);
let nick_command = format!("NICK {}\r\n", leet_nick);
ssl_stream.write_all(nick_command.as_bytes()).unwrap();
}
// turn to mods
// setup so these will only run from the server admin to avoid handle/host conflicts
let commandi = format!("PRIVMSG {} :%%",command_channel); // & check for admin and verify with server