From df3c5be437067edbf3e6d1acf235898d8cef3f4c Mon Sep 17 00:00:00 2001 From: legitnull Date: Fri, 17 Mar 2023 22:24:06 -0600 Subject: [PATCH] fix invade nick collisions to leet --- Cargo.toml | 2 +- src/modules/invade.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b09cc3f..096ff04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" \ No newline at end of file diff --git a/src/modules/invade.rs b/src/modules/invade.rs index b982fde..e8f6f04 100644 --- a/src/modules/invade.rs +++ b/src/modules/invade.rs @@ -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, 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