mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-14 16:35:06 +01:00
the clueless rename
This commit is contained in:
parent
ea28daca0c
commit
9ce60280b1
46 changed files with 264 additions and 262 deletions
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "ssh-agentctl"
|
||||
name = "cluelessh-agentctl"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ssh-agent-client = { path = "../../lib/ssh-agent-client" }
|
||||
ssh-transport = { path = "../../lib/ssh-transport" }
|
||||
cluelessh-agent-client = { path = "../../lib/cluelessh-agent-client" }
|
||||
cluelessh-transport = { path = "../../lib/cluelessh-transport" }
|
||||
|
||||
clap = { version = "4.5.16", features = ["derive"] }
|
||||
eyre = "0.6.12"
|
||||
|
|
@ -3,8 +3,8 @@ use std::{io::Write, path::PathBuf};
|
|||
use clap::Parser;
|
||||
use eyre::{bail, Context};
|
||||
use sha2::Digest;
|
||||
use ssh_agent_client::{IdentityAnswer, SocketAgentConnection};
|
||||
use ssh_transport::{key::PublicKey, parse::Writer};
|
||||
use cluelessh_agent_client::{IdentityAnswer, SocketAgentConnection};
|
||||
use cluelessh_transport::{key::PublicKey, parse::Writer};
|
||||
|
||||
#[derive(clap::Parser, Debug)]
|
||||
struct Args {
|
||||
|
|
@ -52,7 +52,7 @@ async fn main() -> eyre::Result<()> {
|
|||
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info"));
|
||||
tracing_subscriber::fmt().with_env_filter(env_filter).init();
|
||||
|
||||
let mut agent = ssh_agent_client::SocketAgentConnection::from_env().await?;
|
||||
let mut agent = cluelessh_agent_client::SocketAgentConnection::from_env().await?;
|
||||
|
||||
match args.command {
|
||||
Subcommand::AddIdentity { identity } => {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "sshdos"
|
||||
name = "cluelessh-dos"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ssh-protocol = { path = "../../lib/ssh-protocol" }
|
||||
ssh-transport = { path = "../../lib/ssh-transport" }
|
||||
cluelessh-protocol = { path = "../../lib/cluelessh-protocol" }
|
||||
cluelessh-transport = { path = "../../lib/cluelessh-transport" }
|
||||
clap = { version = "4.5.15", features = ["derive"] }
|
||||
eyre = "0.6.12"
|
||||
rand = "0.8.5"
|
||||
|
|
@ -16,14 +16,14 @@ use tokio::{
|
|||
};
|
||||
use tracing::{error, info};
|
||||
|
||||
use ssh_protocol::{
|
||||
use cluelessh_protocol::{
|
||||
transport::{self},
|
||||
SshStatus,
|
||||
};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
struct ThreadRngRand;
|
||||
impl ssh_protocol::transport::SshRng for ThreadRngRand {
|
||||
impl cluelessh_protocol::transport::SshRng for ThreadRngRand {
|
||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||
rand::thread_rng().fill_bytes(dest);
|
||||
}
|
||||
|
|
@ -96,9 +96,9 @@ async fn execute_attempt_inner(mut conn: TcpStream) -> eyre::Result<()> {
|
|||
let mut transport = transport::client::ClientConnection::new(ThreadRngRand);
|
||||
transport.abort_for_dos = true;
|
||||
|
||||
let mut state = ssh_protocol::ClientConnection::new(
|
||||
let mut state = cluelessh_protocol::ClientConnection::new(
|
||||
transport,
|
||||
ssh_protocol::auth::ClientAuth::new(username.as_bytes().to_vec()),
|
||||
cluelessh_protocol::auth::ClientAuth::new(username.as_bytes().to_vec()),
|
||||
);
|
||||
|
||||
let mut buf = [0; 1024];
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "fakesshd"
|
||||
name = "cluelessh-faked"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
eyre = "0.6.12"
|
||||
hex-literal = "0.4.1"
|
||||
rand = "0.8.5"
|
||||
ssh-protocol = { path = "../../lib/ssh-protocol" }
|
||||
cluelessh-protocol = { path = "../../lib/cluelessh-protocol" }
|
||||
|
||||
tokio = { version = "1.39.2", features = ["full"] }
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
||||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
set -euxo pipefail
|
||||
|
||||
cargo build -p fakesshd
|
||||
pkill cluelessh-faked || true
|
||||
|
||||
cargo run -p fakesshd &
|
||||
cargo build -p cluelessh-faked
|
||||
|
||||
cargo run -p cluelessh-faked &
|
||||
|
||||
sleep 1
|
||||
|
||||
|
|
@ -13,4 +15,4 @@ ssh -p 2222 -oCiphers=aes256-gcm@openssh.com \
|
|||
-oHostKeyAlgorithms=ecdsa-sha2-nistp256 \
|
||||
-oKexAlgorithms=ecdh-sha2-nistp256 127.0.0.1 true
|
||||
|
||||
pkill fakesshd
|
||||
pkill cluelessh-faked
|
||||
|
|
@ -8,7 +8,7 @@ use tokio::{
|
|||
};
|
||||
use tracing::{debug, error, info, info_span, Instrument};
|
||||
|
||||
use ssh_protocol::{
|
||||
use cluelessh_protocol::{
|
||||
connection::{ChannelOpen, ChannelOperationKind, ChannelRequest},
|
||||
transport::{self},
|
||||
ChannelUpdateKind, ServerConnection, SshStatus,
|
||||
|
|
@ -16,7 +16,7 @@ use ssh_protocol::{
|
|||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
struct ThreadRngRand;
|
||||
impl ssh_protocol::transport::SshRng for ThreadRngRand {
|
||||
impl cluelessh_protocol::transport::SshRng for ThreadRngRand {
|
||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||
rand::thread_rng().fill_bytes(dest);
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ async fn handle_connection(
|
|||
0x95, 0x18, 0x4b, 0xd2, 0xcb, 0xd0, 0x64, 0x06,
|
||||
];
|
||||
struct HardcodedRng(Vec<u8>);
|
||||
impl ssh_protocol::transport::SshRng for HardcodedRng {
|
||||
impl cluelessh_protocol::transport::SshRng for HardcodedRng {
|
||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||
dest.copy_from_slice(&self.0[..dest.len()]);
|
||||
self.0.splice(0..dest.len(), []);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "ssh-key"
|
||||
name = "cluelessh-key"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ clap = { version = "4.5.16", features = ["derive"] }
|
|||
eyre = "0.6.12"
|
||||
tracing.workspace = true
|
||||
|
||||
ssh-keys = { path = "../../lib/ssh-keys" }
|
||||
cluelessh-keys = { path = "../../lib/cluelessh-keys" }
|
||||
base64 = "0.22.1"
|
||||
rpassword = "7.3.1"
|
||||
pem = "3.0.4"
|
||||
|
|
@ -6,8 +6,8 @@ use std::{
|
|||
|
||||
use base64::Engine;
|
||||
use clap::Parser;
|
||||
use cluelessh_keys::{KeyEncryptionParams, PrivateKeyType};
|
||||
use eyre::{bail, Context};
|
||||
use ssh_keys::{KeyEncryptionParams, PrivateKeyType};
|
||||
|
||||
#[derive(clap::Parser)]
|
||||
struct Args {
|
||||
|
|
@ -82,7 +82,7 @@ fn main() -> eyre::Result<()> {
|
|||
} => {
|
||||
let file = std::fs::read(&id_file)
|
||||
.wrap_err_with(|| format!("reading file {}", id_file.display()))?;
|
||||
let keys = ssh_keys::EncryptedPrivateKeys::parse(&file)?;
|
||||
let keys = cluelessh_keys::EncryptedPrivateKeys::parse(&file)?;
|
||||
let passphrase = if keys.requires_passphrase() {
|
||||
let phrase = rpassword::prompt_password("passphrase: ")?;
|
||||
Some(phrase)
|
||||
|
|
@ -115,7 +115,7 @@ fn info(id_file: &Path, decrypt: bool, show_private: bool) -> eyre::Result<()> {
|
|||
let file =
|
||||
std::fs::read(&id_file).wrap_err_with(|| format!("reading file {}", id_file.display()))?;
|
||||
|
||||
let keys = ssh_keys::EncryptedPrivateKeys::parse(&file)?;
|
||||
let keys = cluelessh_keys::EncryptedPrivateKeys::parse(&file)?;
|
||||
|
||||
if decrypt {
|
||||
let passphrase = if keys.requires_passphrase() {
|
||||
|
|
@ -149,14 +149,14 @@ fn info(id_file: &Path, decrypt: bool, show_private: bool) -> eyre::Result<()> {
|
|||
|
||||
fn generate(type_: KeyType, comment: String, path: &Path) -> eyre::Result<()> {
|
||||
let type_ = match type_ {
|
||||
KeyType::Ed25519 => ssh_keys::KeyType::Ed25519,
|
||||
KeyType::Ed25519 => cluelessh_keys::KeyType::Ed25519,
|
||||
};
|
||||
|
||||
let passphrase = rpassword::prompt_password("Enter passphrase (empty for no passphrase): ")?;
|
||||
|
||||
let key = ssh_keys::PlaintextPrivateKey::generate(
|
||||
let key = cluelessh_keys::PlaintextPrivateKey::generate(
|
||||
comment,
|
||||
ssh_keys::KeyGenerationParams { key_type: type_ },
|
||||
cluelessh_keys::KeyGenerationParams { key_type: type_ },
|
||||
);
|
||||
|
||||
println!("{} {}", key.private_key.public_key(), key.comment);
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
[package]
|
||||
name = "ssh"
|
||||
name = "cluelessh"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ssh-protocol = { path = "../../lib/ssh-protocol" }
|
||||
ssh-transport = { path = "../../lib/ssh-transport" }
|
||||
ssh-agent-client = { path = "../../lib/ssh-agent-client" }
|
||||
ssh-tokio = { path = "../../lib/ssh-tokio" }
|
||||
cluelessh-protocol = { path = "../../lib/cluelessh-protocol" }
|
||||
cluelessh-transport = { path = "../../lib/cluelessh-transport" }
|
||||
cluelessh-agent-client = { path = "../../lib/cluelessh-agent-client" }
|
||||
cluelessh-tokio = { path = "../../lib/cluelessh-tokio" }
|
||||
|
||||
clap = { version = "4.5.15", features = ["derive"] }
|
||||
eyre = "0.6.12"
|
||||
|
|
@ -3,12 +3,12 @@ use std::{collections::HashSet, sync::Arc};
|
|||
use clap::Parser;
|
||||
|
||||
use eyre::{bail, Context, ContextCompat, OptionExt, Result};
|
||||
use ssh_tokio::client::{PendingChannel, SignatureResult};
|
||||
use ssh_transport::{key::PublicKey, numbers, parse::Writer};
|
||||
use cluelessh_tokio::client::{PendingChannel, SignatureResult};
|
||||
use cluelessh_transport::{key::PublicKey, numbers, parse::Writer};
|
||||
use tokio::net::TcpStream;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use ssh_protocol::connection::{ChannelOpen, ChannelOperationKind, ChannelRequest};
|
||||
use cluelessh_protocol::connection::{ChannelOpen, ChannelOperationKind, ChannelRequest};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
#[derive(clap::Parser, Debug)]
|
||||
|
|
@ -50,9 +50,9 @@ async fn main() -> eyre::Result<()> {
|
|||
.wrap_err("connecting")?;
|
||||
|
||||
let username1 = username.clone();
|
||||
let mut tokio_conn = ssh_tokio::client::ClientConnection::connect(
|
||||
let mut tokio_conn = cluelessh_tokio::client::ClientConnection::connect(
|
||||
conn,
|
||||
ssh_tokio::client::ClientAuth {
|
||||
cluelessh_tokio::client::ClientAuth {
|
||||
username: username.clone(),
|
||||
prompt_password: Arc::new(move || {
|
||||
let username = username1.clone();
|
||||
|
|
@ -76,7 +76,7 @@ async fn main() -> eyre::Result<()> {
|
|||
Box::pin(async move {
|
||||
// TODO: support agentless manual key opening
|
||||
// TODO: move
|
||||
let mut agent = ssh_agent_client::SocketAgentConnection::from_env()
|
||||
let mut agent = cluelessh_agent_client::SocketAgentConnection::from_env()
|
||||
.await
|
||||
.wrap_err("failed to connect to SSH agent")?;
|
||||
let identities = agent.list_identities().await?;
|
||||
Loading…
Add table
Add a link
Reference in a new issue