random nick

This commit is contained in:
legitnull 2023-02-21 06:03:32 -07:00
parent d70e8605d6
commit 4a4b0fd10c
6 changed files with 54 additions and 33 deletions

View File

@ -16,3 +16,5 @@ serde = "1.0.152"
tokio-openssl = "0.6.3" tokio-openssl = "0.6.3"
colored = "2" colored = "2"
socks = "0.3.4" socks = "0.3.4"
random_word = "0.3.0"
leetspeak = "0.2.0"

View File

@ -39,16 +39,16 @@
- OpenAI GPT-3 integration: mention G.1.R and he'll respond with AI-generated wisdom (or nonsense, depending on how you see it). - OpenAI GPT-3 integration: mention G.1.R and he'll respond with AI-generated wisdom (or nonsense, depending on how you see it).
- Zim-approved: our resident robot has been certified by the Almighty Tallest to bring chaos and destruction to the IRC world. - Zim-approved: our resident robot has been certified by the Almighty Tallest to bring chaos and destruction to the IRC world.
### COMMANDS ### COMMANDS AND USAGE
- `%ping`: Send this command to G.1.R and he'll respond back with "pong" and the time it took. Because why not? - `%ping`: Send this command to G.1.R and he'll respond back with "pong" and the time it took. Because why not?
- `%kill`: Do you hate your bot companion and want to end his miserable existence? Just type this command and he'll self-destruct, leaving you alone with your conscience (and your loneliness). - `%kill`: Do you hate your bot companion and want to end his miserable existence? Just type this command and he'll self-destruct, leaving you alone with your conscience (and your loneliness).
- `%invade #channel SCREAM`: Do you want to summon the Invaders to a specific channel? This command will do just that, plus a chance to let out your deepest screams of despair. - `%invade 5 #channel SCREAM`: Do you want to summon the Invaders to a specific channel? This command will do just that, plus a chance to let out your deepest screams of despair. 5 being the number of invaders to join!
`%%scream #channel SCREAM`: In case the invaders weren't enough to scare off your enemies, use this command to make them hear your battle cry across the IRC lands. `%%scream #channel SCREAM`: In case the invaders weren't enough to scare off your enemies, use this command to make them hear your battle cry across the IRC lands.
- `%%join #channel`: More bots, more fun! Tell G.1.R to join the party in a specific channel and watch the madness unfold. - `%%join #channel`: More bots, more fun! Tell G.1.R to join the party in a specific channel and watch the madness unfold.
- `%%leave #channel`: Tired of all the chaos? Use this command to make the bots leave the channel and leave you in peace (or in silence, at least). - `%%leave #channel`: Tired of all the chaos? Use this command to make the bots leave the channel and leave you in peace (or in silence, at least).
Pro tip: When you use the `%invade #channel` command, G.1.R will set up that channel to be the commander channel, so you can control all the bots from one place. Talk about efficient invasion tactics! Pro tip: When you use the `%invade #channel` command, G.1.R will set up that channel to be the commander channel, so you can control all the bots from one place and only that place. Talk about efficient invasion tactics!
## TODO ## TODO
@ -59,12 +59,13 @@ Pro tip: When you use the `%invade #channel` command, G.1.R will set up that cha
- [ ] User logs: To keep track of everyone who dares to challenge the Invaders. - [ ] User logs: To keep track of everyone who dares to challenge the Invaders.
- [ ] User cloning: To create a legion of evil twins that will make everyone's life miserable (or just ours). - [ ] User cloning: To create a legion of evil twins that will make everyone's life miserable (or just ours).
- [ ] Console: Because we like to be fancy. - [ ] Console: Because we like to be fancy.
- [ ] Scanner: To find more channels to invade and conquer (or just to chat with). - [ ] Scanner: To find more things to invade and conquer (or just to mess with).
- [x] Colors: To make our messages look pretty (because aesthetics matter). - [x] Colors: To make our messages look pretty (because aesthetics matter).
- [x] Multi-bot: Because one bot is never enough. - [x] Multi-bot: Because one bot is never enough.
- [ ] Invader arguments: Because we like to be flexible and customizable. - [ ] Invader arguments: Because we like to be flexible and customizable.
- [ ] Chat emulators: To trick our enemies into thinking they're talking to real humans (suckers!). - [ ] Chat emulators: To trick our enemies into thinking they're talking to real humans (suckers!).
- [ ] Random nicknames for invaders: Because who wants to be called "Bot 1" forever? - [X] Random nicknames for invaders: Because who wants to be called "Bot 1" forever?
- [ ] DM commander: To control the bots from the shadows, like a true mastermind. - [ ] DM commander: To control the bots from the shadows, like a true mastermind.
- [ ] Key rotation: To avoid API attempts from stopping the invasion.
So what are you waiting for? Join us in our quest for world domination, and let's make Invader Zim proud! So what are you waiting for? Join us in our quest for world domination, and let's make Invader Zim proud!

View File

@ -2,13 +2,17 @@ nick = "g1r"
server = "ircd.chat" server = "ircd.chat"
port = 6697 port = 6697
password = "" password = ""
channels = [ "#tcpdirect", "#macros", "#b0tsh0p" ] channels = [ "#tcpdirect", "#macros", "#b0tsh0p" ] #add key access
admin_users = ["s4d", "s4d[m]"] admin_users = ["s4d", "s4d[m]", "g"] # add host identification
ignore_users = ["maple", "aibird", "professorOak", "van"] ignore_users = ["maple", "aibird", "professorOak", "van"]
openai = "sk-" openai = "sk-"
model = "text-davinci-003" model = "text-davinci-003"
accents = "funny, completely insane, and hyperactive" accents = "funny, completely insane, and hyperactive"
personalities = "GIR from Invader Zim" personalities = "GIR from Invader Zim"
proxy_server = "127.0.0.1"
proxy_port = 9050
# INVADER SETTINGS # INVADER SETTINGS
invaders = ["d1b", "z1m", "t4k", "m3mbr4n3", "g4z", "4l4n", "m1yuk1", "purpl3", "r3d", "5p0rk", "t3nn", "l4rb", "ch1nn", "d00ky", "3l", "fl0rb3", "g00ch", "gr4p4", "gr00t", "k00t", "k1m", "krunk", "l4dn4r", "n3n", "p3st0", "p00t"] invaders = ["d1b", "z1m", "t4k", "m3mbr4n3", "g4z", "4l4n", "m1yuk1", "purpl3", "r3d", "5p0rk", "t3nn", "l4rb", "ch1nn", "d00ky", "3l", "fl0rb3", "g00ch", "gr4p4", "gr00t", "k00t", "k1m", "krunk", "l4dn4r", "n3n", "p3st0", "p00t"]
proxy_list = "./proxies.txt" proxy_list = "./proxies.txt"

View File

@ -5,6 +5,8 @@ use openssl::ssl::{SslMethod, SslConnector};
use toml::Value; use toml::Value;
use serde::Deserialize; use serde::Deserialize;
use colored::*; use colored::*;
mod modules { mod modules {
pub trait Command { pub trait Command {
fn handle(&self, message: &str) -> Vec<String>; fn handle(&self, message: &str) -> Vec<String>;
@ -33,6 +35,7 @@ struct Config {
channels: Vec<String>, channels: Vec<String>,
admin_users: Vec<String>, admin_users: Vec<String>,
ignore_users: Vec<String>, ignore_users: Vec<String>,
} }
fn main() { fn main() {

View File

@ -21,7 +21,7 @@ impl Command for Ai {
let mut responses = Vec::new(); let mut responses = Vec::new();
let config_str = std::fs::read_to_string("config.toml").unwrap(); let config_str = std::fs::read_to_string("config.toml").unwrap();
let config_value = config_str.parse::<Value>().unwrap(); let config_value = config_str.parse::<Value>().unwrap();
let config: Config = config_value.try_into().unwrap(); let config: Config = config_value.try_into().unwrap(); // respond to name with and without leet VVV
if message.starts_with(":") && message.contains("PRIVMSG ") && message.contains(&config.nick) { if message.starts_with(":") && message.contains("PRIVMSG ") && message.contains(&config.nick) {
let channel = message.split("PRIVMSG ").nth(1).and_then(|s| s.splitn(2, ' ').next()).unwrap(); // set the response to varible let channel = message.split("PRIVMSG ").nth(1).and_then(|s| s.splitn(2, ' ').next()).unwrap(); // set the response to varible
let user_message = format!("The following is a chat log:\n{}\nRespond {} as you are chatting as {}: \n\n", let user_message = format!("The following is a chat log:\n{}\nRespond {} as you are chatting as {}: \n\n",

View File

@ -4,13 +4,16 @@ use std::io::{BufRead, BufReader, Write};
use std::net::TcpStream; use std::net::TcpStream;
use openssl::ssl::{SslConnector, SslMethod}; use openssl::ssl::{SslConnector, SslMethod};
use serde::Deserialize; use serde::Deserialize;
use toml::Value; use toml::{Value, to_string};
use colored::*; use colored::*;
// add better error handling
// add ai invasion
// add proxy support optional
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
struct Config { struct Config {
invaders: Vec<String>, //invaders: Vec<String>,
server: String, server: String,
port: u16, port: u16,
@ -27,18 +30,20 @@ impl Command for InvadeCommand {
let num_invaders = parts[4].parse::<u32>().unwrap_or(1) as usize; let num_invaders = parts[4].parse::<u32>().unwrap_or(1) as usize;
let channel = parts[2]; let channel = parts[2];
let invadechannel = parts[5]; let invadechannel = parts[5];
let scream = if parts.len() > 6 { parts[6] } else { "" }; let scream = if parts.len() > 6 { parts[6] } else { "" }; // read entire message
//message.split(&format!("PRIVMSG {} :", channel.to_string())).nth(1).unwrap(),
//let channel = message.split("PRIVMSG ").nth(1).and_then(|s| s.splitn(2, ' ').next()).unwrap();
let config_str = std::fs::read_to_string("config.toml").unwrap(); let config_str = std::fs::read_to_string("config.toml").unwrap();
let config_value = config_str.parse::<Value>().unwrap(); let config_value = config_str.parse::<Value>().unwrap();
let config: Config = config_value.try_into().unwrap(); let config: Config = config_value.try_into().unwrap();
for invader in &config.invaders[0..num_invaders] { for _invader in 1..=num_invaders {//&config.invaders[1..num_invaders] { //1..=20 {
let thread_channel = invadechannel.to_string(); let thread_channel = invadechannel.to_string();
let thread_invader = invader.to_string();
let config_clone = config.clone(); let config_clone = config.clone();
let screaming = scream.to_string(); let screaming = scream.to_string();
let command_channel = channel.to_string(); let command_channel = channel.to_string();
let thread_invader = random_word::gen(); // change to leetspeak on nick collision
std::thread::spawn(move || { std::thread::spawn(move || {
let stream = TcpStream::connect((config_clone.server.as_str(), config_clone.port)).unwrap(); let stream = TcpStream::connect((config_clone.server.as_str(), config_clone.port)).unwrap();
@ -74,28 +79,34 @@ impl Command for InvadeCommand {
println!("{} {}","[%] PONG:".bold().green(), thread_invader.blue()); println!("{} {}","[%] PONG:".bold().green(), thread_invader.blue());
ssl_stream.write_all(response.as_bytes()).unwrap(); ssl_stream.write_all(response.as_bytes()).unwrap();
} }
// setup so these will only run from the commander // turn to mods
if message.contains("PRIVMSG") && message.contains(":%%join") { // setup so these will only run from the server admin to avoid handle/host conflicts
let parts: Vec<&str> = message.splitn(3, ":%%join ").collect(); let commandi = format!("PRIVMSG {} :%%",command_channel); // & check for admin and verify with server
let invade_channel = parts[1];
let response = format!("JOIN {} \r\n", invade_channel); if message.contains(&commandi) && message.contains(":%%") {
ssl_stream.write_all(response.as_bytes()).unwrap(); if message.contains("PRIVMSG") && message.contains(":%%join") { // fix so commands get picked up faster
} let parts: Vec<&str> = message.splitn(3, ":%%join ").collect();
if message.contains("PRIVMSG") && message.contains(":%%leave") { let invade_channel = parts[1];
let parts: Vec<&str> = message.splitn(3, ":%%leave ").collect(); let response = format!("JOIN {} \r\n", invade_channel);
let invade_channel = parts[1];
let response = format!("PART {} \r\n", invade_channel);
ssl_stream.write_all(response.as_bytes()).unwrap();
}
if message.contains("PRIVMSG") && message.contains(":%%scream") {
let parts: Vec<&str> = message.splitn(3, ":%%scream ").collect();
let invade_channel = parts[1];
if parts.len() == 2 {
let scream = parts[1];
let response = format!("PRIVMSG {} :{}\r\n", invade_channel, scream);
ssl_stream.write_all(response.as_bytes()).unwrap(); ssl_stream.write_all(response.as_bytes()).unwrap();
} }
if message.contains("PRIVMSG") && message.contains(":%%leave") {
let parts: Vec<&str> = message.splitn(3, ":%%leave ").collect();
let invade_channel = parts[1];
let response = format!("PART {} \r\n", invade_channel);
ssl_stream.write_all(response.as_bytes()).unwrap();
}
if message.contains("PRIVMSG") && message.contains(":%%scream") {
let parts: Vec<&str> = message.splitn(3, ":%%scream ").collect();
let invade_channel = parts[1];
if parts.len() == 2 {
let scream = parts[1];
let response = format!("PRIVMSG {} :{}\r\n", invade_channel, scream);
ssl_stream.write_all(response.as_bytes()).unwrap();
}
}
} }
// ...1
} }
Err(e) => { Err(e) => {
eprintln!("{} {}","[!] ERROR FROM SERVER:".on_red(), e); eprintln!("{} {}","[!] ERROR FROM SERVER:".on_red(), e);