update
This commit is contained in:
parent
c2731fdb43
commit
aba851bd0d
4 changed files with 46 additions and 0 deletions
1
LICENSE
Normal file
1
LICENSE
Normal file
|
@ -0,0 +1 @@
|
|||
use at ur own risk lmao
|
0
const.ml
Normal file
0
const.ml
Normal file
27
coq_ssh.ml
27
coq_ssh.ml
|
@ -1,6 +1,11 @@
|
|||
(* ssh rfc: https://datatracker.ietf.org/doc/html/rfc4253 *)
|
||||
|
||||
open Unix
|
||||
open Printf
|
||||
|
||||
open CoqSSH
|
||||
open Message
|
||||
module M = Message
|
||||
|
||||
let () =
|
||||
let addr_str = "10.7.0.4" in
|
||||
|
@ -29,6 +34,28 @@ let () =
|
|||
|
||||
(* 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
|
||||
match n with
|
||||
| SSH.O -> print_endline "o"
|
||||
|
|
18
message.ml
Normal file
18
message.ml
Normal 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
|
Loading…
Reference in a new issue