mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-16 01:15:04 +01:00
move to fakesshd
This commit is contained in:
parent
c8842ef22a
commit
01c43606a2
6 changed files with 48 additions and 34 deletions
23
Cargo.lock
generated
23
Cargo.lock
generated
|
|
@ -123,9 +123,12 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.8"
|
version = "1.1.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549"
|
checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
|
|
@ -321,7 +324,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fakessh"
|
name = "fakesshd"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"eyre",
|
"eyre",
|
||||||
|
|
@ -503,9 +506,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
|
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -831,9 +834,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.122"
|
version = "1.0.125"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
|
checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
|
@ -861,6 +864,12 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signal-hook-registry"
|
name = "signal-hook-registry"
|
||||||
version = "1.4.2"
|
version = "1.4.2"
|
||||||
|
|
|
||||||
18
Cargo.toml
18
Cargo.toml
|
|
@ -1,17 +1,3 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["ssh-connection", "ssh-protocol", "ssh-transport"]
|
members = ["fakesshd", "ssh-connection", "ssh-protocol", "ssh-transport"]
|
||||||
|
resolver = "2"
|
||||||
[package]
|
|
||||||
name = "fakessh"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
eyre = "0.6.12"
|
|
||||||
hex-literal = "0.4.1"
|
|
||||||
rand = "0.8.5"
|
|
||||||
ssh-protocol = { path = "./ssh-protocol" }
|
|
||||||
|
|
||||||
tokio = { version = "1.39.2", features = ["full"] }
|
|
||||||
tracing = "0.1.40"
|
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
|
||||||
|
|
|
||||||
14
fakesshd/Cargo.toml
Normal file
14
fakesshd/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[package]
|
||||||
|
name = "fakesshd"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
eyre = "0.6.12"
|
||||||
|
hex-literal = "0.4.1"
|
||||||
|
rand = "0.8.5"
|
||||||
|
ssh-protocol = { path = "../ssh-protocol" }
|
||||||
|
|
||||||
|
tokio = { version = "1.39.2", features = ["full"] }
|
||||||
|
tracing = "0.1.40"
|
||||||
|
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
||||||
|
|
@ -51,8 +51,14 @@ pub const ENC_AES128_CTR: EncryptionAlgorithm = EncryptionAlgorithm {
|
||||||
let mut alg = Aes128Ctr::from_state(state);
|
let mut alg = Aes128Ctr::from_state(state);
|
||||||
alg.decrypt_len(bytes, packet_number)
|
alg.decrypt_len(bytes, packet_number)
|
||||||
},
|
},
|
||||||
decrypt_packet: |state, bytes, packet_number| todo!(),
|
decrypt_packet: |state, bytes, packet_number| {
|
||||||
encrypt_packet: |state, packet, packet_number| todo!(),
|
let mut state = Aes128Ctr::from_state(state);
|
||||||
|
state.decrypt_packet(bytes, packet_number)
|
||||||
|
},
|
||||||
|
encrypt_packet: |state, packet, packet_number| {
|
||||||
|
let mut state = Aes128Ctr::from_state(state);
|
||||||
|
state.encrypt_packet(packet, packet_number)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// `chacha20-poly1305@openssh.com` uses a 64-bit nonce, not the 96-bit one in the IETF version.
|
/// `chacha20-poly1305@openssh.com` uses a 64-bit nonce, not the 96-bit one in the IETF version.
|
||||||
|
|
@ -229,21 +235,19 @@ impl<'a> Aes256GcmOpenSsh<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Aes128Ctr {
|
struct Aes128Ctr {
|
||||||
key: ctr::Ctr128BE<aes::Aes128>,
|
_key: ctr::Ctr128BE<aes::Aes128>,
|
||||||
}
|
}
|
||||||
impl Aes128Ctr {
|
impl Aes128Ctr {
|
||||||
fn from_state(keys: &mut [u8]) -> Self {
|
fn from_state(_keys: &mut [u8]) -> Self {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decrypt_len(&mut self, _: &mut [u8], _: u64) {
|
fn decrypt_len(&mut self, _: &mut [u8], _: u64) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn decrypt_packet(&mut self, mut bytes: RawPacket, _packet_number: u64) -> Result<Packet> {
|
fn decrypt_packet(&mut self, _bytes: RawPacket, _packet_number: u64) -> Result<Packet> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn encrypt_packet(&mut self, packet: Packet, _packet_number: u64) -> EncryptedPacket {
|
fn encrypt_packet(&mut self, _packet: Packet, _packet_number: u64) -> EncryptedPacket {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,18 +196,19 @@ impl ServerConnection {
|
||||||
hostkey_algorithms.find(kex.server_host_key_algorithms.0)?;
|
hostkey_algorithms.find(kex.server_host_key_algorithms.0)?;
|
||||||
debug!(name = %server_host_key_algorithm.name(), "Using host key algorithm");
|
debug!(name = %server_host_key_algorithm.name(), "Using host key algorithm");
|
||||||
|
|
||||||
|
// TODO: Implement aes128-ctr
|
||||||
|
let _ = crypto::encrypt::ENC_AES128_CTR;
|
||||||
|
|
||||||
let encryption_algorithms_client_to_server = AlgorithmNegotiation {
|
let encryption_algorithms_client_to_server = AlgorithmNegotiation {
|
||||||
supported: vec![
|
supported: vec![
|
||||||
crypto::encrypt::CHACHA20POLY1305,
|
crypto::encrypt::CHACHA20POLY1305,
|
||||||
crypto::encrypt::AES256_GCM,
|
crypto::encrypt::AES256_GCM,
|
||||||
// crypto::encrypt::ENC_AES128_CTR,
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
let encryption_algorithms_server_to_client = AlgorithmNegotiation {
|
let encryption_algorithms_server_to_client = AlgorithmNegotiation {
|
||||||
supported: vec![
|
supported: vec![
|
||||||
crypto::encrypt::CHACHA20POLY1305,
|
crypto::encrypt::CHACHA20POLY1305,
|
||||||
crypto::encrypt::AES256_GCM,
|
crypto::encrypt::AES256_GCM,
|
||||||
// crypto::encrypt::ENC_AES128_CTR,
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue