This commit is contained in:
Michael Zhang 2021-06-11 00:36:41 -05:00
parent c2731fdb43
commit aba851bd0d
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 46 additions and 0 deletions

1
LICENSE Normal file
View file

@ -0,0 +1 @@
use at ur own risk lmao

0
const.ml Normal file
View file

View file

@ -1,6 +1,11 @@
(* ssh rfc: https://datatracker.ietf.org/doc/html/rfc4253 *)
open Unix open Unix
open Printf open Printf
open CoqSSH open CoqSSH
open Message
module M = Message
let () = let () =
let addr_str = "10.7.0.4" in let addr_str = "10.7.0.4" in
@ -29,6 +34,28 @@ let () =
(* key exchange *) (* key exchange *)
let kex_msg = M.empty () in
M.add_byte kex_msg msg_kexinit;
(*
byte SSH_MSG_KEXINIT
byte[16] cookie (random bytes)
name-list kex_algorithms
name-list server_host_key_algorithms
name-list encryption_algorithms_client_to_server
name-list encryption_algorithms_server_to_client
name-list mac_algorithms_client_to_server
name-list mac_algorithms_server_to_client
name-list compression_algorithms_client_to_server
name-list compression_algorithms_server_to_client
name-list languages_client_to_server
name-list languages_server_to_client
boolean first_kex_packet_follows
uint32 0 (reserved for future extension)
*)
printf "len %d\n" (M.off kex_msg);
(* random crap *)
let n : SSH.nat = SSH.O in let n : SSH.nat = SSH.O in
match n with match n with
| SSH.O -> print_endline "o" | SSH.O -> print_endline "o"

18
message.ml Normal file
View file

@ -0,0 +1,18 @@
open Char
(* constants *)
let msg_kexinit = chr 20
(* Mutable data structure representing a message *)
module Message = struct
type t = Bytes.t * int ref
let empty () : t = (Bytes.create 40, ref 0)
let off (m : t) : int = let (_, len) = m in !len
let add_byte (m : t) (c : char) : unit =
let (bytes, len) = m in
Bytes.set bytes !len c;
len := !len + 1;
end