feat: added connection and authentication
client can now generate a server binary, and try to connect to it and get capabilities
This commit is contained in:
@@ -6,6 +6,8 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ecies-ed25519 = { version = "0.5.1", features = ["serde"] }
|
||||
ed25519-dalek = { version = "1.0.1", features = ["serde"] }
|
||||
rand = "0.7"
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
serde_repr = "0.1"
|
||||
|
||||
@@ -3,17 +3,12 @@ pub const CONFIG_SEPARATOR: &'static [u8] =
|
||||
|
||||
pub mod messages {
|
||||
pub const CONNECT_MESSAGE: &'static [u8] = b"CONNECT";
|
||||
pub const CONNECTED_MESSAGE: &'static [u8] = b"CONNECTED";
|
||||
|
||||
use std::{ffi::OsString, path::PathBuf};
|
||||
|
||||
use ed25519_dalek::Signature;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct CommandWrapper {
|
||||
sig: Signature,
|
||||
command: Vec<u8>,
|
||||
}
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum Command {
|
||||
@@ -61,7 +56,7 @@ pub mod messages {
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum Response {
|
||||
Connected(Capabilities),
|
||||
// Connected(Capabilities, ed25519_dalek::PublicKey, ecies_ed25519::PublicKey),
|
||||
SendData(Vec<u8>),
|
||||
|
||||
CdDone,
|
||||
@@ -76,14 +71,23 @@ pub mod messages {
|
||||
DownloadFileSegment(u64, u64, Vec<u8>),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy)]
|
||||
#[repr(u8)]
|
||||
pub enum TransportType {
|
||||
RawUdp,
|
||||
Udp,
|
||||
}
|
||||
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy)]
|
||||
#[repr(u8)]
|
||||
pub enum OperatingSystem {
|
||||
Windows,
|
||||
Linux,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Capabilities {
|
||||
pub operating_system: OperatingSystem,
|
||||
pub docker_container: bool,
|
||||
pub docker_breakout: bool,
|
||||
pub setuid: bool,
|
||||
|
||||
Reference in New Issue
Block a user