From b56bd73ecb31f2f4de3a8668997c14d909c7e664 Mon Sep 17 00:00:00 2001 From: Matt Johnston <matt@ucc.asn.au> Date: Thu, 22 Sep 2022 22:06:30 +0800 Subject: [PATCH] Remove old main.rs, fix some othe rcompilation --- Cargo.lock | 4 -- Cargo.toml | 6 --- src/main.rs | 3 -- sshproto/examples/kex1.rs | 89 --------------------------------------- sshproto/src/test.rs | 2 +- 5 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 src/main.rs delete mode 100644 sshproto/examples/kex1.rs diff --git a/Cargo.lock b/Cargo.lock index f3a1c77..87594b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -332,10 +332,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" -[[package]] -name = "door" -version = "0.1.0" - [[package]] name = "door-async" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index c930a8a..b8173c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,3 @@ -[package] -name = "door" -version = "0.1.0" -edition = "2021" -license = "MPL-2.0" - [workspace] members = [ "sshproto", diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/sshproto/examples/kex1.rs b/sshproto/examples/kex1.rs deleted file mode 100644 index a2d3499..0000000 --- a/sshproto/examples/kex1.rs +++ /dev/null @@ -1,89 +0,0 @@ -#![allow(unused_imports)] - -use anyhow::{Context, Error, Result}; -use pretty_hex::PrettyHex; - -use door_sshproto::*; -use door_sshproto::packets::*; -use door_sshproto::sshwire::BinString; - -use simplelog::{TestLogger,self,LevelFilter}; - -fn main() -> Result<()> { - let _ = TestLogger::init(LevelFilter::Trace, simplelog::Config::default()); - // do_kexinit()?; - do_userauth()?; - Ok(()) -} - -fn do_userauth() -> Result<()> { - let p: Packet = packets::UserauthRequest { - username: "matt".into(), - service: "con", - method: AuthMethod::Password(packets::MethodPassword { change: false, password: "123".into() }), - }.into(); - - let mut buf = vec![0; 2000]; - let written = door_sshproto::sshwire::write_ssh(&mut buf, &p)?; - buf.truncate(written); - println!("buf {:?}", buf.hex_dump()); - - let ctx = ParseContext::new(); - let x: Packet = door_sshproto::sshwire::packet_from_bytes(&buf, &ctx)?; - println!("{x:?}"); - - Ok(()) - - -} - -fn do_kexinit() -> Result<()> { - - let k = KexInit { - // cookie: &[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], - cookie: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], - kex: "hello,more".try_into().unwrap(), - hostkey: "hello,more".try_into().unwrap(), - cipher_c2s: "hello,more".try_into().unwrap(), - cipher_s2c: "hello,more".try_into().unwrap(), - mac_c2s: "hi".try_into().unwrap(), - mac_s2c: "hello,more".try_into().unwrap(), - comp_c2s: "hello,more".try_into().unwrap(), - comp_s2c: "hello,more".try_into().unwrap(), - lang_c2s: "hello,more".try_into().unwrap(), - lang_s2c: "hello,more".try_into().unwrap(), - first_follows: false, - reserved: 0, - }; - let p = Packet::KexInit(k); - println!("p {p:?}"); - - let bs = BinString(&[0x11, 0x22, 0x33]); - let dhc: Packet = KexDHInit { q_c: bs }.into(); - println!("dhc1 {dhc:?}"); - - // if let SpecificPacket::KexInit(ref k2) = p.p { - // let t = toml::to_string(&k2)?; - // println!("as toml:\n{}", t); - - // } - // let k2: KexInit = toml::from_str(&t).context("deser")?; - // println!("kex2 {k:?}"); - - - let mut buf = vec![0; 2000]; - let written = door_sshproto::sshwire::write_ssh(&mut buf, &p)?; - buf.truncate(written); - println!("{:?}", buf.hex_dump()); - let ctx = ParseContext::new(); - let x: Packet = door_sshproto::sshwire::packet_from_bytes(&buf, &ctx)?; - println!("fetched {x:?}"); - - // let cli= Client::new(); - // let c = Conn::new_client(cli)?; - // let mut work = vec![0; 2000]; - // let mut r = conn::Runner::new(c, work.as_mut_slice())?; - // r.input(&buf)?; - Ok(()) - -} diff --git a/sshproto/src/test.rs b/sshproto/src/test.rs index b0ebe7e..14f0ff9 100644 --- a/sshproto/src/test.rs +++ b/sshproto/src/test.rs @@ -36,7 +36,7 @@ mod tests { let k = KexInit { cookie: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], kex: "kex".try_into().unwrap(), - hostkey: "hostkey,another".try_into().unwrap(), + hostsig: "hostkey,another".try_into().unwrap(), cipher_c2s: "chacha20-poly1305@openssh.com,aes128-ctr".try_into().unwrap(), cipher_s2c: "blowfish".try_into().unwrap(), mac_c2s: "hmac-sha1".try_into().unwrap(), -- GitLab