From 670eb3937f543794203c776beea9cdebd646ad5f Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Sat, 23 Mar 2024 19:02:23 +1100 Subject: [PATCH] Added basic whois support --- .vscode/settings.json | 5 + Cargo.lock | 583 ++++++++++++++++++++++++++++++- Cargo.toml | 2 + servers.json | 783 ++++++++++++++++++++++++++++++++++++++++++ src/domain.rs | 58 ++-- src/main.rs | 9 +- src/whois.rs | 169 +++++++++ 7 files changed, 1572 insertions(+), 37 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 servers.json create mode 100644 src/whois.rs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..352a626 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "rust-analyzer.linkedProjects": [ + "./Cargo.toml" + ] +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 3bb3b8e..1e072e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,32 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "async-trait" version = "0.1.78" @@ -25,7 +51,7 @@ checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.53", ] [[package]] @@ -55,6 +81,75 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "borsh" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.53", + "syn_derive", +] + +[[package]] +name = "byte-unit" +version = "5.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" +dependencies = [ + "rust_decimal", + "serde", + "utf8-width", +] + +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "bytes" version = "1.5.0" @@ -73,6 +168,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "configparser" version = "3.0.4" @@ -91,8 +192,28 @@ version = "0.1.0" dependencies = [ "configparser", "hickory-resolver", + "regex", + "whois-rust", ] +[[package]] +name = "educe" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4bd92664bf78c4d3dba9b7cdafce6fa15b13ed3ed16175218196942e99168a8" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + [[package]] name = "enum-as-inner" version = "0.6.0" @@ -102,9 +223,35 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.53", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -114,6 +261,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures-channel" version = "0.3.30" @@ -171,6 +324,21 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "heck" version = "0.4.1" @@ -259,6 +427,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + [[package]] name = "ipconfig" version = "0.3.2" @@ -277,6 +455,12 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + [[package]] name = "libc" version = "0.2.153" @@ -340,6 +524,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.16.0" @@ -412,6 +614,38 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.79" @@ -421,6 +655,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -436,6 +690,22 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + [[package]] name = "rand" version = "0.8.5" @@ -475,6 +745,44 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + [[package]] name = "resolv-conf" version = "0.7.0" @@ -485,18 +793,118 @@ dependencies = [ "quick-error", ] +[[package]] +name = "rkyv" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rust_decimal" +version = "1.34.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39449a79f45e8da28c57c341891b69a183044b29518bb8f86dbac9df60bb7df" +dependencies = [ + "arrayvec", + "borsh", + "bytes", + "num-traits", + "rand", + "rkyv", + "serde", + "serde_json", +] + [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "semver" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + [[package]] name = "slab" version = "0.4.9" @@ -522,6 +930,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.53" @@ -533,6 +952,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "thiserror" version = "1.0.58" @@ -550,7 +987,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.53", ] [[package]] @@ -584,6 +1021,23 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.40" @@ -603,7 +1057,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.53", ] [[package]] @@ -615,6 +1069,50 @@ dependencies = [ "once_cell", ] +[[package]] +name = "trust-dns-client" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14135e72c7e6d4c9b6902d4437881a8598f0145dbb2e3f86f92dbad845b61e63" +dependencies = [ + "cfg-if", + "data-encoding", + "futures-channel", + "futures-util", + "once_cell", + "radix_trie", + "rand", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto", +] + +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -647,12 +1145,71 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "validators" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e4dd623e1c294e7d7850097c41863cda2703166c5f58c225c5ca969299fb7a" +dependencies = [ + "byte-unit", + "data-encoding", + "idna 0.5.0", + "semver", + "serde", + "serde_json", + "validators-derive", +] + +[[package]] +name = "validators-derive" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72377736834d42b3e4029d46058f7ee2dbd44340bed0e82aaffd5c395bb0e6b3" +dependencies = [ + "educe", + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "whois-rust" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e98fa932e195e0253ae71fc1b6e206e53ae7031c40b24ff6b68eaabbf5e87f" +dependencies = [ + "once_cell", + "regex", + "serde_json", + "trust-dns-client", + "validators", +] + [[package]] name = "widestring" version = "1.0.2" @@ -813,6 +1370,15 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -822,3 +1388,12 @@ dependencies = [ "cfg-if", "windows-sys 0.48.0", ] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] diff --git a/Cargo.toml b/Cargo.toml index 6a5e7f3..e8aa0fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,5 @@ edition = "2021" [dependencies] configparser = "3.0.4" hickory-resolver = { version = "0.24.0" } +regex = "1.10.3" +whois-rust = "1.6.0" diff --git a/servers.json b/servers.json new file mode 100644 index 0000000..1e3f26d --- /dev/null +++ b/servers.json @@ -0,0 +1,783 @@ +{ + "br.com": "whois.centralnic.net", + "cn.com": "whois.centralnic.net", + "de.com": "whois.centralnic.net", + "eu.com": "whois.centralnic.net", + "gb.com": "whois.centralnic.net", + "gb.net": "whois.centralnic.net", + "gr.com": "whois.centralnic.net", + "hu.com": "whois.centralnic.net", + "in.net": "whois.centralnic.net", + "jpn.com": "whois.centralnic.net", + "no.com": "whois.centralnic.net", + "qc.com": "whois.centralnic.net", + "ru.com": "whois.centralnic.net", + "sa.com": "whois.centralnic.net", + "se.com": "whois.centralnic.net", + "se.net": "whois.centralnic.net", + "uk.com": "whois.centralnic.net", + "uk.net": "whois.centralnic.net", + "us.com": "whois.centralnic.net", + "uy.com": "whois.centralnic.net", + "web.com": "whois.centralnic.net", + "za.com": "whois.centralnic.net", + "com": { + "host": "whois.verisign-grs.com", + "query": "DOMAIN $addr\r\n" + }, + "za.net": "whois.za.net", + "net": { + "host": "whois.verisign-grs.com", + "query": "DOMAIN $addr\r\n" + }, + "eu.org": "whois.eu.org", + "za.org": "whois.za.org", + "org": "whois.pir.org", + "edu": "whois.educause.edu", + "gov": "whois.dotgov.gov", + "int": "whois.iana.org", + "mil": null, + "e164.arpa": "whois.ripe.net", + "in-addr.arpa": null, + "arpa": "whois.iana.org", + "aero": "whois.aero", + "asia": "whois.nic.asia", + "biz": "whois.biz", + "cat": "whois.cat", + "coop": "whois.nic.coop", + "info": "whois.afilias.net", + "jobs": "jobswhois.verisign-grs.com", + "mobi": "whois.dotmobiregistry.net", + "museum": "whois.museum", + "name": "whois.nic.name", + "post": "whois.dotpostregistry.net", + "pro": "whois.afilias.net", + "tel": "whois.nic.tel", + "travel": "whois.nic.travel", + "xxx": "whois.nic.xxx", + "academy": "whois.nic.academy", + "accountants": "whois.nic.accountants", + "actor": "whois.nic.actor", + "agency": "whois.nic.agency", + "airforce": "whois.nic.airforce", + "apartments": "whois.nic.apartments", + "app": "whois.nic.google", + "archi": "whois.nic.archi", + "army": "whois.nic.army", + "associates": "whois.nic.associates", + "attorney": "whois.nic.attorney", + "auction": "whois.nic.auction", + "audio": "whois.nic.audio", + "autos": "whois.nic.autos", + "axa": "whois.nic.axa", + "band": "whois.nic.band", + "bar": "whois.nic.bar", + "bargains": "whois.nic.bargains", + "bayern": "whois.nic.bayern", + "beer": "whois.nic.beer", + "berlin": "whois.nic.berlin", + "best": "whois.nic.best", + "bid": "whois.nic.bid", + "bike": "whois.nic.bike", + "bingo": "whois.nic.bingo", + "black": "whois.nic.black", + "blackfriday": "whois.nic.blackfriday", + "blog": "whois.nic.blog", + "blue": "whois.nic.blue", + "boutique": "whois.nic.boutique", + "build": "whois.nic.build", + "builders": "whois.nic.builders", + "business": "whois.nic.business", + "buzz": "whois.nic.buzz", + "cab": "whois.nic.cab", + "cafe": "whois.nic.cafe", + "camera": "whois.nic.camera", + "camp": "whois.nic.camp", + "capital": "whois.nic.capital", + "cards": "whois.nic.cards", + "care": "whois.nic.care", + "career": "whois.nic.career", + "careers": "whois.nic.careers", + "cash": "whois.nic.cash", + "casino": "whois.nic.casino", + "catering": "whois.nic.catering", + "center": "whois.nic.center", + "ceo": "whois.nic.ceo", + "charity": "whois.nic.charity", + "chat": "whois.nic.chat", + "cheap": "whois.nic.cheap", + "christmas": "whois.nic.christmas", + "church": "whois.nic.church", + "citic": "whois.nic.citic", + "city": "whois.nic.city", + "claims": "whois.nic.claims", + "cleaning": "whois.nic.cleaning", + "clinic": "whois.nic.clinic", + "clothing": "whois.nic.clothing", + "cloud": "whois.nic.cloud", + "club": "whois.nic.club", + "coach": "whois.nic.coach", + "codes": "whois.nic.codes", + "coffee": "whois.nic.coffee", + "college": "whois.nic.college", + "cologne": "whois.nic.cologne", + "community": "whois.nic.community", + "company": "whois.nic.company", + "computer": "whois.nic.computer", + "condos": "whois.nic.condos", + "construction": "whois.nic.construction", + "consulting": "whois.nic.consulting", + "contractors": "whois.nic.contractors", + "cooking": "whois.nic.cooking", + "cool": "whois.nic.cool", + "country": "whois.nic.country", + "coupons": "whois.nic.coupons", + "credit": "whois.nic.credit", + "creditcard": "whois.nic.creditcard", + "cruises": "whois.nic.cruises", + "dance": "whois.nic.dance", + "dating": "whois.nic.dating", + "deals": "whois.nic.deals", + "degree": "whois.nic.degree", + "delivery": "whois.nic.delivery", + "democrat": "whois.nic.democrat", + "dental": "whois.nic.dental", + "dentist": "whois.nic.dentist", + "desi": "whois.nic.desi", + "dev": "whois.nic.google", + "diamonds": "whois.nic.diamonds", + "digital": "whois.donuts.co", + "direct": "whois.nic.direct", + "directory": "whois.nic.directory", + "discount": "whois.nic.discount", + "dnp": "whois.nic.dnp", + "doctor": "whois.nic.doctor", + "dog": "whois.nic.dog", + "domains": "whois.nic.domains", + "education": "whois.nic.education", + "email": "whois.nic.email", + "energy": "whois.nic.energy", + "engineer": "whois.nic.engineer", + "engineering": "whois.nic.engineering", + "enterprises": "whois.nic.enterprises", + "equipment": "whois.nic.equipment", + "estate": "whois.nic.estate", + "eus": "whois.nic.eus", + "events": "whois.nic.events", + "exchange": "whois.nic.exchange", + "expert": "whois.nic.expert", + "exposed": "whois.nic.exposed", + "express": "whois.nic.express", + "fail": "whois.nic.fail", + "family": "whois.nic.family", + "fan": "whois.nic.fan", + "farm": "whois.nic.farm", + "feedback": "whois.nic.feedback", + "finance": "whois.nic.finance", + "financial": "whois.nic.financial", + "fish": "whois.nic.fish", + "fishing": "whois.nic.fishing", + "fitness": "whois.nic.fitness", + "flights": "whois.nic.flights", + "florist": "whois.nic.florist", + "foo": "whois.nic.foo", + "football": "whois.nic.football", + "forsale": "whois.nic.forsale", + "foundation": "whois.nic.foundation", + "frogans": "whois.nic.frogans", + "fun": "whois.nic.fun", + "fund": "whois.nic.fund", + "furniture": "whois.nic.furniture", + "futbol": "whois.nic.futbol", + "fyi": "whois.nic.fyi", + "gal": "whois.nic.gal", + "gallery": "whois.nic.gallery", + "games": "whois.nic.games", + "gift": "whois.nic.gift", + "gifts": "whois.nic.gifts", + "gives": "whois.nic.gives", + "glass": "whois.nic.glass", + "global": "whois.nic.global", + "globo": "whois.nic.globo", + "gmbh": "whois.nic.gmbh", + "gmo": "whois.nic.gmo", + "gold": "whois.nic.gold", + "golf": "whois.nic.golf", + "gop": "whois.nic.gop", + "graphics": "whois.nic.graphics", + "gratis": "whois.nic.gratis", + "gripe": "whois.nic.gripe", + "group": "whois.nic.group", + "guide": "whois.nic.guide", + "guitars": "whois.nic.guitars", + "guru": "whois.nic.guru", + "haus": "whois.nic.haus", + "healthcare": "whois.nic.healthcare", + "hiphop": "whois.nic.hiphop", + "hockey": "whois.nic.hockey", + "holdings": "whois.nic.holdings", + "holiday": "whois.nic.holiday", + "homes": "whois.nic.homes", + "horse": "whois.nic.horse", + "hospital": "whois.nic.hospital", + "host": "whois.nic.host", + "house": "whois.nic.house", + "immo": "whois.nic.immo", + "immobilien": "whois.nic.immobilien", + "industries": "whois.nic.industries", + "ink": "whois.nic.ink", + "institute": "whois.nic.institute", + "insure": "whois.nic.insure", + "international": "whois.nic.international", + "investments": "whois.nic.investments", + "irish": "whois.nic.irish", + "jetzt": "whois.nic.jetzt", + "jewelry": "whois.nic.jewelry", + "juegos": "whois.nic.juegos", + "kaufen": "whois.nic.kaufen", + "kim": "whois.nic.kim", + "kitchen": "whois.nic.kitchen", + "kiwi": "whois.nic.kiwi", + "koeln": "whois.nic.koeln", + "kred": "whois.nic.kred", + "land": "whois.nic.land", + "lawyer": "whois.nic.lawyer", + "lease": "whois.nic.lease", + "legal": "whois.nic.legal", + "life": "whois.nic.life", + "lighting": "whois.nic.lighting", + "limited": "whois.nic.limited", + "limo": "whois.nic.limo", + "link": "whois.nic.link", + "live": "whois.nic.live", + "loans": "whois.nic.loans", + "london": "whois.nic.london", + "love": "whois.nic.love", + "ltd": "whois.nic.ltd", + "luxe": "whois.nic.luxe", + "luxury": "whois.nic.luxury", + "maison": "whois.nic.maison", + "management": "whois.nic.management", + "mango": "whois.nic.mango", + "market": "whois.nic.market", + "marketing": "whois.nic.marketing", + "mba": "whois.nic.mba", + "media": "whois.nic.media", + "meet": "whois.nic.meet", + "memorial": "whois.nic.memorial", + "menu": "whois.nic.menu", + "miami": "whois.nic.miami", + "moda": "whois.nic.moda", + "moe": "whois.nic.moe", + "monash": "whois.nic.monash", + "money": "whois.nic.money", + "mortgage": "whois.nic.mortgage", + "moscow": "whois.nic.moscow", + "motorcycles": "whois.nic.motorcycles", + "movie": "whois.nic.movie", + "nagoya": "whois.nic.nagoya", + "navy": "whois.nic.navy", + "network": "whois.nic.network", + "neustar": "whois.nic.neustar", + "news": "whois.nic.news", + "ninja": "whois.nic.ninja", + "nyc": "whois.nic.nyc", + "okinawa": "whois.nic.okinawa", + "one": "whois.nic.one", + "onl": "whois.nic.onl", + "online": "whois.centralnic.net", + "paris": "whois.nic.paris", + "partners": "whois.nic.partners", + "parts": "whois.nic.parts", + "photo": "whois.nic.photo", + "photography": "whois.nic.photography", + "photos": "whois.nic.photos", + "pics": "whois.nic.pics", + "pictures": "whois.nic.pictures", + "pink": "whois.nic.pink", + "pizza": "whois.nic.pizza", + "place": "whois.nic.place", + "plumbing": "whois.nic.plumbing", + "plus": "whois.nic.plus", + "press": "whois.nic.press", + "productions": "whois.nic.productions", + "properties": "whois.nic.properties", + "pub": "whois.nic.pub", + "qpon": "whois.nic.qpon", + "quebec": "whois.nic.quebec", + "recipes": "whois.nic.recipes", + "red": "whois.nic.red", + "rehab": "whois.nic.rehab", + "reise": "whois.nic.reise", + "reisen": "whois.nic.reisen", + "ren": "whois.nic.ren", + "rentals": "whois.nic.rentals", + "repair": "whois.nic.repair", + "report": "whois.nic.report", + "republican": "whois.nic.republican", + "rest": "whois.nic.rest", + "restaurant": "whois.nic.restaurant", + "reviews": "whois.nic.reviews", + "rich": "whois.nic.rich", + "rio": "whois.nic.rio", + "rip": "whois.nic.rip", + "rocks": "whois.nic.rocks", + "rodeo": "whois.nic.rodeo", + "ruhr": "whois.nic.ruhr", + "run": "whois.nic.run", + "ryukyu": "whois.nic.ryukyu", + "saarland": "whois.nic.saarland", + "sale": "whois.nic.sale", + "salon": "whois.nic.salon", + "sarl": "whois.nic.sarl", + "school": "whois.nic.school", + "schule": "whois.nic.schule", + "services": "whois.nic.services", + "sexy": "whois.nic.sexy", + "shiksha": "whois.nic.shiksha", + "shoes": "whois.nic.shoes", + "shopping": "whois.nic.shopping", + "show": "whois.nic.show", + "singles": "whois.nic.singles", + "site": "whois.nic.site", + "soccer": "whois.nic.soccer", + "social": "whois.nic.social", + "software": "whois.nic.software", + "sohu": "whois.nic.sohu", + "solar": "whois.nic.solar", + "solutions": "whois.nic.solutions", + "soy": "whois.nic.soy", + "space": "whois.nic.space", + "sport": "whois.nic.sport", + "store": "whois.nic.store", + "studio": "whois.nic.studio", + "style": "whois.nic.style", + "supplies": "whois.nic.supplies", + "supply": "whois.nic.supply", + "support": "whois.nic.support", + "surgery": "whois.nic.surgery", + "systems": "whois.nic.systems", + "tattoo": "whois.nic.tattoo", + "tax": "whois.nic.tax", + "taxi": "whois.nic.taxi", + "team": "whois.nic.team", + "tech": "whois.nic.tech", + "technology": "whois.nic.technology", + "tennis": "whois.nic.tennis", + "theater": "whois.nic.theater", + "tienda": "whois.nic.tienda", + "tips": "whois.nic.tips", + "tires": "whois.nic.tires", + "today": "whois.nic.today", + "tokyo": "whois.nic.tokyo", + "tools": "whois.nic.tools", + "top": "whois.nic.top", + "tours": "whois.nic.tours", + "town": "whois.nic.town", + "toys": "whois.nic.toys", + "trade": "whois.nic.trade", + "training": "whois.nic.training", + "university": "whois.nic.university", + "uno": "whois.nic.uno", + "vacations": "whois.nic.vacations", + "vegas": "whois.nic.vegas", + "ventures": "whois.nic.ventures", + "versicherung": "whois.nic.versicherung", + "vet": "whois.nic.vet", + "viajes": "whois.nic.viajes", + "video": "whois.nic.video", + "villas": "whois.nic.villas", + "vin": "whois.nic.vin", + "vip": "whois.nic.vip", + "vision": "whois.nic.vision", + "vodka": "whois.nic.vodka", + "vote": "whois.nic.vote", + "voting": "whois.nic.voting", + "voto": "whois.nic.voto", + "voyage": "whois.nic.voyage", + "wang": "whois.nic.wang", + "watch": "whois.nic.watch", + "webcam": "whois.nic.webcam", + "website": "whois.nic.website", + "wed": "whois.nic.wed", + "wien": "whois.nic.wien", + "wiki": "whois.nic.wiki", + "wine": "whois.nic.wine", + "works": "whois.nic.works", + "world": "whois.nic.world", + "wtc": "whois.nic.wtc", + "wtf": "whois.nic.wtf", + "xn--3bst00m": "whois.nic.xn--3bst00m", + "xn--3ds443g": "whois.nic.xn--3ds443g", + "xn--55qw42g": "whois.nic.xn--55qw42g", + "xn--55qx5d": "whois.nic.xn--55qx5d", + "xn--6frz82g": "whois.nic.xn--6frz82g", + "xn--6qq986b3xl": "whois.nic.xn--6qq986b3xl", + "xn--80adxhks": "whois.nic.xn--80adxhks", + "xn--80asehdb": "whois.nic.xn--80asehdb", + "xn--80aswg": "whois.nic.xn--80aswg", + "xn--c1avg": "whois.nic.xn--c1avg", + "xn--cg4bki": "whois.nic.xn--cg4bki", + "xn--czrs0t": "whois.nic.xn--czrs0t", + "xn--czr694b": "whois.nic.xn--czr694b", + "xn--czru2d": "whois.nic.xn--czru2d", + "xn--d1acj3b": "whois.nic.xn--d1acj3b", + "xn--fiq228c5hs": "whois.nic.xn--fiq228c5hs", + "xn--fiq64b": "whois.nic.xn--fiq64b", + "xn--i1b6b1a6a2e": "whois.nic.xn--i1b6b1a6a2e", + "xn--io0a7i": "whois.nic.xn--io0a7i", + "xn--mgbab2bd": "whois.nic.xn--mgbab2bd", + "xn--ngbc5azd": "whois.nic.xn--ngbc5azd", + "xn--nqv7f": "whois.nic.xn--nqv7f", + "xn--nqv7fs00ema": "whois.nic.xn--nqv7fs00ema", + "xn--q9jyb4c": "whois.nic.xn--q9jyb4c", + "xn--rhqv96g": "whois.nic.xn--rhqv96g", + "xn--ses554g": "whois.nic.xn--ses554g", + "xn--unup4y": "whois.nic.xn--unup4y", + "xn--vhquv": "whois.nic.xn--vhquv", + "xn--zfr164b": "whois.nic.xn--zfr164b", + "xyz": "whois.nic.xyz", + "yachts": "whois.nic.yachts", + "yokohama": "whois.nic.yokohama", + "zone": "whois.nic.zone", + "ac": "whois.nic.ac", + "ad": null, + "ae": "whois.aeda.net.ae", + "af": "whois.nic.af", + "ag": "whois.nic.ag", + "ai": "whois.nic.ai", + "al": null, + "am": "whois.amnic.net", + "an": null, + "ao": null, + "aq": null, + "ar": null, + "as": "whois.nic.as", + "priv.at": "whois.nic.priv.at", + "at": "whois.nic.at", + "au": "whois.auda.org.au", + "aw": "whois.nic.aw", + "ax": "whois.ax", + "az": null, + "ba": null, + "bb": null, + "bd": null, + "be": "whois.dns.be", + "bf": null, + "bg": "whois.register.bg", + "bh": null, + "bi": "whois1.nic.bi", + "bj": "whois.nic.bj", + "bl": null, + "bm": "whois.afilias-srs.net", + "bn": "whois.bn", + "bo": "whois.nic.bo", + "bq": null, + "br": "whois.registro.br", + "bs": null, + "bt": null, + "bv": null, + "by": "whois.cctld.by", + "bw": "whois.nic.net.bw", + "bz": "whois.afilias-grs.info", + "co.ca": "whois.co.ca", + "ca": "whois.cira.ca", + "cc": "ccwhois.verisign-grs.com", + "cd": "whois.nic.cd", + "cf": "whois.dot.cf", + "cg": null, + "ch": "whois.nic.ch", + "ci": "whois.nic.ci", + "ck": null, + "cl": "whois.nic.cl", + "cm": "whois.netcom.cm", + "edu.cn": "whois.edu.cn", + "cn": "whois.cnnic.cn", + "uk.co": "whois.uk.co", + "co": "whois.nic.co", + "cr": "whois.nic.cr", + "cu": null, + "cv": null, + "cw": null, + "cx": "whois.nic.cx", + "cy": null, + "cz": "whois.nic.cz", + "de": { + "host": "whois.denic.de", + "query": "-T dn $addr\r\n", + "punycode": false + }, + "dj": null, + "dk": { + "host": "whois.dk-hostmaster.dk", + "query": "--charset=utf-8 --show-handles $addr\r\n" + }, + "dm": "whois.nic.dm", + "do": "whois.nic.do", + "dz": "whois.nic.dz", + "ec": "whois.nic.ec", + "ee": "whois.tld.ee", + "eg": null, + "eh": null, + "er": null, + "es": null, + "et": null, + "eu": "whois.eu", + "fi": "whois.fi", + "fj": "whois.usp.ac.fj", + "fk": null, + "fm": "whois.nic.fm", + "fo": "whois.nic.fo", + "fr": "whois.nic.fr", + "ga": "whois.dot.ga", + "gb": null, + "gd": "whois.nic.gd", + "ge": "whois.nic.ge", + "gf": "whois.mediaserv.net", + "gg": "whois.gg", + "gh": "whois.nic.gh", + "gi": "whois.afilias-grs.info", + "gl": "whois.nic.gl", + "gm": null, + "gn": null, + "gp": "whois.nic.gp", + "gq": "whois.dominio.gq", + "gr": null, + "gs": "whois.nic.gs", + "gt": null, + "gu": null, + "gw": null, + "gy": "whois.registry.gy", + "hk": "whois.hkirc.hk", + "hm": "whois.registry.hm", + "hn": "whois.nic.hn", + "hr": "whois.dns.hr", + "ht": "whois.nic.ht", + "hu": "whois.nic.hu", + "id": "whois.pandi.or.id", + "ie": "whois.domainregistry.ie", + "il": "whois.isoc.org.il", + "im": "whois.nic.im", + "in": "whois.registry.in", + "io": "whois.nic.io", + "iq": "whois.cmc.iq", + "ir": "whois.nic.ir", + "is": "whois.isnic.is", + "it": "whois.nic.it", + "je": "whois.je", + "jm": null, + "jo": null, + "jp": { + "host": "whois.jprs.jp", + "query": "$addr/e\r\n" + }, + "ke": "whois.kenic.or.ke", + "kg": "whois.domain.kg", + "kh": null, + "ki": "whois.nic.ki", + "km": null, + "kn": "whois.nic.kn", + "kp": null, + "kr": "whois.kr", + "kw": null, + "ky": "whois.kyregistry.ky", + "kz": "whois.nic.kz", + "la": "whois.nic.la", + "lb": null, + "lc": "whois.afilias-grs.info", + "li": "whois.nic.li", + "lk": "whois.nic.lk", + "lr": null, + "ls": "whois.nic.ls", + "lt": "whois.domreg.lt", + "lu": "whois.dns.lu", + "lv": "whois.nic.lv", + "ly": "whois.nic.ly", + "ma": "whois.iam.net.ma", + "mc": null, + "md": "whois.nic.md", + "me": "whois.nic.me", + "mf": null, + "mg": "whois.nic.mg", + "mh": null, + "mk": "whois.marnet.mk", + "ml": "whois.dot.ml", + "mm": null, + "mn": "whois.nic.mn", + "mo": null, + "mp": null, + "mq": "whois.mediaserv.net", + "mr": "whois.nic.mr", + "ms": "whois.nic.ms", + "mt": null, + "mu": "whois.nic.mu", + "mv": null, + "mw": "whois.nic.mw", + "mx": "whois.mx", + "my": "whois.domainregistry.my", + "mz": "whois.nic.mz", + "na": "whois.na-nic.com.na", + "nc": "whois.nc", + "ne": null, + "nf": "whois.nic.nf", + "ng": "whois.nic.net.ng", + "ni": null, + "nl": "whois.domain-registry.nl", + "no": { + "host": "whois.norid.no", + "query": "-c utf-8 $addr\r\n" + }, + "np": null, + "nr": null, + "nu": "whois.iis.nu", + "nz": "whois.srs.net.nz", + "om": "whois.registry.om", + "pa": null, + "pe": "kero.yachay.pe", + "pf": "whois.registry.pf", + "pg": null, + "ph": null, + "pk": null, + "co.pl": "whois.co.pl", + "pl": "whois.dns.pl", + "pm": "whois.nic.pm", + "pn": null, + "pr": "whois.nic.pr", + "ps": "whois.pnina.ps", + "pt": "whois.dns.pt", + "pw": "whois.nic.pw", + "py": null, + "qa": "whois.registry.qa", + "re": "whois.nic.re", + "ro": "whois.rotld.ro", + "rs": "whois.rnids.rs", + "edu.ru": "whois.informika.ru", + "ru": "whois.tcinet.ru", + "rw": "whois.ricta.org.rw", + "sa": "whois.nic.net.sa", + "sb": "whois.nic.sb", + "sc": "whois.afilias-grs.info", + "sd": null, + "se": "whois.iis.se", + "sg": "whois.sgnic.sg", + "sh": "whois.nic.sh", + "si": "whois.arnes.si", + "sj": null, + "sk": "whois.sk-nic.sk", + "sl": "whois.nic.sl", + "sm": "whois.nic.sm", + "sn": "whois.nic.sn", + "so": "whois.nic.so", + "sr": null, + "ss": "whois.nic.ss", + "st": "whois.nic.st", + "su": "whois.tcinet.ru", + "sv": null, + "sx": "whois.sx", + "sy": "whois.tld.sy", + "sz": null, + "tc": "whois.nic.tc", + "td": "whois.nic.td", + "tf": "whois.nic.tf", + "tg": "whois.nic.tg", + "th": "whois.thnic.co.th", + "tj": null, + "tk": "whois.dot.tk", + "tl": "whois.nic.tl", + "tm": "whois.nic.tm", + "tn": "whois.ati.tn", + "to": "whois.tonic.to", + "tp": null, + "tr": "whois.nic.tr", + "tt": null, + "tv": "tvwhois.verisign-grs.com", + "tw": "whois.twnic.net.tw", + "tz": "whois.tznic.or.tz", + "biz.ua": "whois.biz.ua", + "co.ua": "whois.co.ua", + "pp.ua": "whois.pp.ua", + "ua": "whois.ua", + "ug": "whois.co.ug", + "ac.uk": "whois.ja.net", + "bl.uk": null, + "british-library.uk": null, + "gov.uk": "whois.ja.net", + "icnet.uk": null, + "jet.uk": null, + "mod.uk": null, + "nhs.uk": null, + "nls.uk": null, + "parliament.uk": null, + "police.uk": null, + "uk": "whois.nic.uk", + "um": null, + "fed.us": "whois.nic.gov", + "us": "whois.nic.us", + "com.uy": null, + "uy": "whois.nic.org.uy", + "uz": "whois.cctld.uz", + "va": null, + "vc": "whois.afilias-grs.info", + "ve": "whois.nic.ve", + "vg": "whois.nic.vg", + "vi": null, + "vn": null, + "vu": "vunic.vu", + "wf": "whois.nic.wf", + "ws": "whois.website.ws", + "ye": null, + "yt": "whois.nic.yt", + "ac.za": "whois.ac.za", + "alt.za": "whois.alt.za", + "co.za": "whois.registry.net.za", + "gov.za": "whois.gov.za", + "net.za": "whois.net.za", + "org.za": null, + "web.za": "whois.web.za", + "za": null, + "zm": "whois.nic.zm", + "zw": null, + "xn--3e0b707e": "whois.kr", + "xn--45brj9c": "whois.inregistry.net", + "xn--80ao21a": "whois.nic.kz", + "xn--90a3ac": "whois.rnids.rs", + "xn--clchc0ea0b2g2a9gcd": "whois.sgnic.sg", + "xn--fiqs8s": "cwhois.cnnic.cn", + "xn--fiqz9s": "cwhois.cnnic.cn", + "xn--fpcrj9c3d": "whois.inregistry.net", + "xn--fzc2c9e2c": "whois.nic.lk", + "xn--gecrj9c": "whois.inregistry.net", + "xn--h2brj9c": "whois.inregistry.net", + "xn--j1amh": "whois.dotukr.com", + "xn--j6w193g": "whois.hkirc.hk", + "xn--kprw13d": "whois.twnic.net.tw", + "xn--kpry57d": "whois.twnic.net.tw", + "xn--l1acc": "whois.nic.mn", + "xn--lgbbat1ad8j": "whois.nic.dz", + "xn--mgb9awbf": "whois.registry.om", + "xn--mgba3a4f16a": "whois.nic.ir", + "xn--mgbaam7a8h": "whois.aeda.net.ae", + "xn--mgbayh7gpa": null, + "xn--mgbbh1a71e": "whois.inregistry.net", + "xn--mgbc0a9azcg": null, + "xn--mgberp4a5d4ar": "whois.nic.net.sa", + "xn--mgbx4cd0ab": "whois.domainregistry.my", + "xn--o3cw4h": "whois.thnic.co.th", + "xn--ogbpf8fl": "whois.tld.sy", + "xn--p1ai": "whois.tcinet.ru", + "xn--pgbs0dh": null, + "xn--s9brj9c": "whois.inregistry.net", + "xn--wgbh1c": "whois.dotmasr.eg", + "xn--wgbl6a": "whois.registry.qa", + "xn--xkc2al3hye2a": "whois.nic.lk", + "xn--xkc2dl3a5ee0h": "whois.inregistry.net", + "xn--yfro4i67o": "whois.sgnic.sg", + "xn--ygbi2ammx": "whois.pnina.ps", + "": "whois.iana.org", + "_": { + "ip": { + "host": "whois.arin.net", + "query": "n + $addr\r\n" + } + } +} \ No newline at end of file diff --git a/src/domain.rs b/src/domain.rs index 5c0aa5a..c286838 100644 --- a/src/domain.rs +++ b/src/domain.rs @@ -1,6 +1,6 @@ +use hickory_resolver::config::*; use hickory_resolver::proto::rr::rdata::*; use hickory_resolver::Resolver; -use hickory_resolver::config::*; use core::fmt; @@ -8,7 +8,7 @@ use crate::config::Config; // #[derive(Debug)] pub struct Domain { - domain_name: String, + pub domain_name: String, subdomains: Vec, a_records: Vec, aaaa_records: Vec, @@ -84,29 +84,29 @@ impl Domain { } pub fn lookup_all_records(&mut self) { - // Lookup A records - self.lookup_a(); + // Lookup A records + self.lookup_a(); - // Lookup AAAA records + // Lookup AAAA records self.lookup_aaaa(); - // Lookup MX records - self.lookup_mx(); + // Lookup MX records + self.lookup_mx(); - // Lookup TXT records - self.lookup_txt(); + // Lookup TXT records + self.lookup_txt(); - // Lookup TXT records - self.lookup_ns(); + // Lookup TXT records + self.lookup_ns(); - // Lookup TXT records - self.lookup_soa(); + // Lookup TXT records + self.lookup_soa(); - // Do subdomains? - for subdomain in &mut self.subdomains { - // println!("Looking up subdomain: {}", subdomain.domain_name); - subdomain.lookup_all_records(); - } + // Do subdomains? + for subdomain in &mut self.subdomains { + // println!("Looking up subdomain: {}", subdomain.domain_name); + subdomain.lookup_all_records(); + } } fn lookup_a(&mut self) { @@ -116,8 +116,8 @@ impl Domain { for entry in rec { self.a_records.push(entry); } - }, - Err(_err) => {}, + } + Err(_err) => {} } } @@ -128,7 +128,7 @@ impl Domain { for entry in rec { self.aaaa_records.push(entry); } - }, + } Err(_err) => {} // Log error } } @@ -140,8 +140,8 @@ impl Domain { for entry in rec { self.mx_records.push(entry); } - }, - Err(_err) => {}, + } + Err(_err) => {} } } @@ -152,8 +152,8 @@ impl Domain { for entry in rec { self.txt_records.push(entry); } - }, - Err(_err) => {}, + } + Err(_err) => {} } } @@ -164,8 +164,8 @@ impl Domain { for entry in rec { self.ns_records.push(entry); } - }, - Err(_err) => {}, + } + Err(_err) => {} } } @@ -176,8 +176,8 @@ impl Domain { for entry in rec { self.soa_records.push(entry); } - }, - Err(_err) => {}, + } + Err(_err) => {} } } } diff --git a/src/main.rs b/src/main.rs index 94b249f..659ad3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,14 +4,15 @@ use crate::domain::Domain; mod config; use crate::config::Config; +mod whois; +use crate::whois::WhoisData; fn main() { - - let mut test = Domain::new("benjamyn.love".to_string()); + let mut test = Domain::new("ventraip.com.au".to_string()); let config = Config::from_file("test.ini".to_string()); test.apply_config(&config); test.lookup_all_records(); + let whois = WhoisData::new(test.domain_name.clone()); - println!("{}", test); - + println!("Domain: {}\n{}", test.domain_name.clone(), whois); } diff --git a/src/whois.rs b/src/whois.rs new file mode 100644 index 0000000..0fe800d --- /dev/null +++ b/src/whois.rs @@ -0,0 +1,169 @@ +use core::fmt; +use hickory_resolver::{proto::rr::rdata::name, Name}; +use regex::Regex; +use std::fmt::Write as _; +use whois_rust::{WhoIs, WhoIsLookupOptions}; + +#[derive(Debug)] +enum RegistrantType { + Registrant, + Admin, + Tech, + Billing, +} + +struct RegexQuery { + re: Regex, +} + +impl RegexQuery { + fn new(expression: String) -> RegexQuery { + let re = Regex::new(&expression).unwrap(); + RegexQuery { re } + } + + fn get_matches(&self, haystack: &str) -> Vec { + let mut results = vec![]; + for (_, [_, rex2]) in self.re.captures_iter(haystack).map(|c| c.extract()) { + results.push(String::from(rex2.trim())); + } + results + } +} + +#[derive(Debug)] +struct NameServer { + host: String, +} + +impl NameServer { + fn new(host: String) -> NameServer { + NameServer { host } + } +} + +#[derive(Debug)] +struct Registrant { + name: String, + org: String, + email: String, + rtype: RegistrantType, +} + +impl fmt::Display for Registrant { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "") + } +} + +impl Registrant { + fn new(name: String, org: String, email: String, rtype: RegistrantType) -> Registrant { + Registrant { + name, + org, + email, + rtype, + } + } +} + +pub struct WhoisData { + registrar: String, + domain_status: String, + registrant: Vec, + nameservers: Vec, + dnssec: String, +} + +impl fmt::Display for WhoisData { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "Registrar: {}\nStatus: {}\nRegistrant: {:?}\nNameservers: {:?}\nDNSSEC: {}", + self.registrar, self.domain_status, self.registrant, self.nameservers, self.dnssec + ) + } +} + +impl WhoisData { + pub fn new(domain: String) -> WhoisData { + let whois = WhoIs::from_path("servers.json").unwrap(); + let result: String = whois + .lookup(WhoIsLookupOptions::from_string(domain).unwrap()) + .unwrap(); + let registrar_regex = RegexQuery::new(String::from(r"(?i)(.*registrar:)(.*)")); + let domain_status_regex = RegexQuery::new(String::from(r"(?i)(.*domain status:)(.*)")); + // TODO: Capture the registrant info for each type + let registrant_name_regex = RegexQuery::new(String::from(r"(?i)(registrant name:)(.*)")); + let registrant_org_regex = RegexQuery::new(String::from(r"(?i)(registrant org.*:)(.*)")); + let registrant_email_regex = RegexQuery::new(String::from(r"(?i)(registrant email:)(.*)")); + + let nameserver_regex = + RegexQuery::new(String::from(r"(?i)(nameservers*:|name servers*:)(.*)")); + let dnssec_regex = RegexQuery::new(String::from(r"(?i)(.*dnssec:)(.*)")); + + let registrar_caps = registrar_regex.get_matches(&result); + let registrar: String; + match registrar_caps.get(0) { + Some(reg) => { + registrar = reg.to_string(); + } + None => { + registrar = String::from("None"); + } + } + let domain_status = domain_status_regex.get_matches(&result); + let reg_name_caps = registrant_name_regex.get_matches(&result); + let reg_name: String; + match reg_name_caps.get(0) { + Some(name) => { + reg_name = name.to_string(); + } + None => { + reg_name = String::from("None"); + } + } + + let reg_org_caps = registrant_org_regex.get_matches(&result); + let reg_org: String; + match reg_org_caps.get(0) { + Some(org) => { + reg_org = org.to_string(); + } + None => { + reg_org = String::from("None"); + } + } + + let reg_email_caps = registrant_email_regex.get_matches(&result); + let reg_email: String; + match reg_email_caps.get(0) { + Some(email) => { + reg_email = email.to_string(); + } + None => { + reg_email = String::from("None"); + } + } + + let mut nameservers = vec![]; + for nameserver in nameserver_regex.get_matches(&result) { + nameservers.push(NameServer::new(nameserver)); + } + let dnssec = dnssec_regex.get_matches(&result); + + // println!("{:?}", registrar[0]); + WhoisData { + registrar: registrar.clone(), + domain_status: domain_status[0].clone(), + registrant: vec![Registrant::new( + reg_name.clone(), + reg_org.clone(), + reg_email, + RegistrantType::Registrant, + )], + nameservers: nameservers, + dnssec: dnssec[0].clone(), + } + } +}