This repository has been archived on 2024-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
dns-toy/bin/main.ml

20 lines
648 B
OCaml
Raw Normal View History

2023-06-11 10:54:58 +02:00
open Dnstoy
2023-07-04 10:50:03 +02:00
let print = function
| Some value -> print_endline (Utils.get_bytecode value)
| None -> print_endline "No IP found"
;;
2023-06-11 10:54:58 +02:00
let () =
2023-07-04 10:50:03 +02:00
let response = Network.send_request "8.8.8.8" "www.mylloon.fr" Types.DNSType.a in
2023-06-14 16:35:14 +02:00
print_endline (Utils.get_bytecode response);
2023-06-19 21:52:39 +02:00
let dns_packet = Response.parse_dns_packet response in
2023-06-19 23:23:13 +02:00
print_endline (Debug.dns_packet dns_packet);
2023-07-04 10:50:03 +02:00
print (Network.lookup_domain "example.com");
print (Network.lookup_domain "recurse.com");
print (Network.lookup_domain "www.metafilter.com");
List.iter
(fun e -> print_endline (Debug.dns_record e))
(Network.send "8.8.8.8" "example.com" 16).answers
2023-06-11 10:54:58 +02:00
;;