├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── img ├── DNS_hierarchy.png ├── code.svg ├── github.gif └── logo.svg └── src ├── dns_query.rs ├── file_read.rs └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ansi_term" 7 | version = "0.12.1" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 10 | dependencies = [ 11 | "winapi", 12 | ] 13 | 14 | [[package]] 15 | name = "async-trait" 16 | version = "0.1.57" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" 19 | dependencies = [ 20 | "proc-macro2", 21 | "quote", 22 | "syn", 23 | ] 24 | 25 | [[package]] 26 | name = "atty" 27 | version = "0.2.14" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 30 | dependencies = [ 31 | "hermit-abi", 32 | "libc", 33 | "winapi", 34 | ] 35 | 36 | [[package]] 37 | name = "autocfg" 38 | version = "1.1.0" 39 | source = "registry+https://github.com/rust-lang/crates.io-index" 40 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 41 | 42 | [[package]] 43 | name = "bitflags" 44 | version = "1.3.2" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 47 | 48 | [[package]] 49 | name = "bytes" 50 | version = "1.2.1" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" 53 | 54 | [[package]] 55 | name = "cfg-if" 56 | version = "1.0.0" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 59 | 60 | [[package]] 61 | name = "clap" 62 | version = "2.34.0" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 65 | dependencies = [ 66 | "ansi_term", 67 | "atty", 68 | "bitflags", 69 | "strsim", 70 | "textwrap", 71 | "unicode-width", 72 | "vec_map", 73 | ] 74 | 75 | [[package]] 76 | name = "data-encoding" 77 | version = "2.3.2" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" 80 | 81 | [[package]] 82 | name = "endian-type" 83 | version = "0.1.2" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" 86 | 87 | [[package]] 88 | name = "enum-as-inner" 89 | version = "0.4.0" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" 92 | dependencies = [ 93 | "heck", 94 | "proc-macro2", 95 | "quote", 96 | "syn", 97 | ] 98 | 99 | [[package]] 100 | name = "form_urlencoded" 101 | version = "1.0.1" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 104 | dependencies = [ 105 | "matches", 106 | "percent-encoding", 107 | ] 108 | 109 | [[package]] 110 | name = "futures" 111 | version = "0.3.24" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" 114 | dependencies = [ 115 | "futures-channel", 116 | "futures-core", 117 | "futures-executor", 118 | "futures-io", 119 | "futures-sink", 120 | "futures-task", 121 | "futures-util", 122 | ] 123 | 124 | [[package]] 125 | name = "futures-channel" 126 | version = "0.3.24" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" 129 | dependencies = [ 130 | "futures-core", 131 | "futures-sink", 132 | ] 133 | 134 | [[package]] 135 | name = "futures-core" 136 | version = "0.3.24" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" 139 | 140 | [[package]] 141 | name = "futures-executor" 142 | version = "0.3.24" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" 145 | dependencies = [ 146 | "futures-core", 147 | "futures-task", 148 | "futures-util", 149 | ] 150 | 151 | [[package]] 152 | name = "futures-io" 153 | version = "0.3.24" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" 156 | 157 | [[package]] 158 | name = "futures-macro" 159 | version = "0.3.24" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" 162 | dependencies = [ 163 | "proc-macro2", 164 | "quote", 165 | "syn", 166 | ] 167 | 168 | [[package]] 169 | name = "futures-sink" 170 | version = "0.3.24" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" 173 | 174 | [[package]] 175 | name = "futures-task" 176 | version = "0.3.24" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" 179 | 180 | [[package]] 181 | name = "futures-util" 182 | version = "0.3.24" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" 185 | dependencies = [ 186 | "futures-channel", 187 | "futures-core", 188 | "futures-io", 189 | "futures-macro", 190 | "futures-sink", 191 | "futures-task", 192 | "memchr", 193 | "pin-project-lite", 194 | "pin-utils", 195 | "slab", 196 | ] 197 | 198 | [[package]] 199 | name = "getrandom" 200 | version = "0.2.7" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" 203 | dependencies = [ 204 | "cfg-if", 205 | "libc", 206 | "wasi", 207 | ] 208 | 209 | [[package]] 210 | name = "heck" 211 | version = "0.4.0" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" 214 | 215 | [[package]] 216 | name = "hermit-abi" 217 | version = "0.1.19" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 220 | dependencies = [ 221 | "libc", 222 | ] 223 | 224 | [[package]] 225 | name = "idna" 226 | version = "0.2.3" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 229 | dependencies = [ 230 | "matches", 231 | "unicode-bidi", 232 | "unicode-normalization", 233 | ] 234 | 235 | [[package]] 236 | name = "ipnet" 237 | version = "2.5.0" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" 240 | 241 | [[package]] 242 | name = "lazy_static" 243 | version = "1.4.0" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 246 | 247 | [[package]] 248 | name = "libc" 249 | version = "0.2.132" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" 252 | 253 | [[package]] 254 | name = "lock_api" 255 | version = "0.4.8" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" 258 | dependencies = [ 259 | "autocfg", 260 | "scopeguard", 261 | ] 262 | 263 | [[package]] 264 | name = "log" 265 | version = "0.4.17" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 268 | dependencies = [ 269 | "cfg-if", 270 | ] 271 | 272 | [[package]] 273 | name = "matches" 274 | version = "0.1.9" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 277 | 278 | [[package]] 279 | name = "memchr" 280 | version = "2.5.0" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 283 | 284 | [[package]] 285 | name = "mio" 286 | version = "0.8.4" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" 289 | dependencies = [ 290 | "libc", 291 | "log", 292 | "wasi", 293 | "windows-sys", 294 | ] 295 | 296 | [[package]] 297 | name = "nibble_vec" 298 | version = "0.1.0" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" 301 | dependencies = [ 302 | "smallvec", 303 | ] 304 | 305 | [[package]] 306 | name = "num_cpus" 307 | version = "1.13.1" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 310 | dependencies = [ 311 | "hermit-abi", 312 | "libc", 313 | ] 314 | 315 | [[package]] 316 | name = "num_threads" 317 | version = "0.1.6" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" 320 | dependencies = [ 321 | "libc", 322 | ] 323 | 324 | [[package]] 325 | name = "once_cell" 326 | version = "1.13.1" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" 329 | 330 | [[package]] 331 | name = "parking_lot" 332 | version = "0.12.1" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 335 | dependencies = [ 336 | "lock_api", 337 | "parking_lot_core", 338 | ] 339 | 340 | [[package]] 341 | name = "parking_lot_core" 342 | version = "0.9.3" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" 345 | dependencies = [ 346 | "cfg-if", 347 | "libc", 348 | "redox_syscall", 349 | "smallvec", 350 | "windows-sys", 351 | ] 352 | 353 | [[package]] 354 | name = "percent-encoding" 355 | version = "2.1.0" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 358 | 359 | [[package]] 360 | name = "pin-project-lite" 361 | version = "0.2.9" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 364 | 365 | [[package]] 366 | name = "pin-utils" 367 | version = "0.1.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 370 | 371 | [[package]] 372 | name = "ppv-lite86" 373 | version = "0.2.16" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 376 | 377 | [[package]] 378 | name = "proc-macro2" 379 | version = "1.0.43" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" 382 | dependencies = [ 383 | "unicode-ident", 384 | ] 385 | 386 | [[package]] 387 | name = "quote" 388 | version = "1.0.21" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 391 | dependencies = [ 392 | "proc-macro2", 393 | ] 394 | 395 | [[package]] 396 | name = "radix_trie" 397 | version = "0.2.1" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" 400 | dependencies = [ 401 | "endian-type", 402 | "nibble_vec", 403 | ] 404 | 405 | [[package]] 406 | name = "rand" 407 | version = "0.8.5" 408 | source = "registry+https://github.com/rust-lang/crates.io-index" 409 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 410 | dependencies = [ 411 | "libc", 412 | "rand_chacha", 413 | "rand_core", 414 | ] 415 | 416 | [[package]] 417 | name = "rand_chacha" 418 | version = "0.3.1" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 421 | dependencies = [ 422 | "ppv-lite86", 423 | "rand_core", 424 | ] 425 | 426 | [[package]] 427 | name = "rand_core" 428 | version = "0.6.3" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 431 | dependencies = [ 432 | "getrandom", 433 | ] 434 | 435 | [[package]] 436 | name = "redox_syscall" 437 | version = "0.2.16" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 440 | dependencies = [ 441 | "bitflags", 442 | ] 443 | 444 | [[package]] 445 | name = "scopeguard" 446 | version = "1.1.0" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 449 | 450 | [[package]] 451 | name = "signal-hook-registry" 452 | version = "1.4.0" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 455 | dependencies = [ 456 | "libc", 457 | ] 458 | 459 | [[package]] 460 | name = "slab" 461 | version = "0.4.7" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" 464 | dependencies = [ 465 | "autocfg", 466 | ] 467 | 468 | [[package]] 469 | name = "smallvec" 470 | version = "1.9.0" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" 473 | 474 | [[package]] 475 | name = "socket2" 476 | version = "0.4.7" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" 479 | dependencies = [ 480 | "libc", 481 | "winapi", 482 | ] 483 | 484 | [[package]] 485 | name = "strsim" 486 | version = "0.8.0" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 489 | 490 | [[package]] 491 | name = "subdomains_brute" 492 | version = "0.1.0" 493 | dependencies = [ 494 | "clap", 495 | "futures", 496 | "tokio", 497 | "trust-dns-client", 498 | "trust-dns-proto", 499 | ] 500 | 501 | [[package]] 502 | name = "syn" 503 | version = "1.0.99" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" 506 | dependencies = [ 507 | "proc-macro2", 508 | "quote", 509 | "unicode-ident", 510 | ] 511 | 512 | [[package]] 513 | name = "textwrap" 514 | version = "0.11.0" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 517 | dependencies = [ 518 | "unicode-width", 519 | ] 520 | 521 | [[package]] 522 | name = "thiserror" 523 | version = "1.0.33" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57" 526 | dependencies = [ 527 | "thiserror-impl", 528 | ] 529 | 530 | [[package]] 531 | name = "thiserror-impl" 532 | version = "1.0.33" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09" 535 | dependencies = [ 536 | "proc-macro2", 537 | "quote", 538 | "syn", 539 | ] 540 | 541 | [[package]] 542 | name = "time" 543 | version = "0.3.14" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" 546 | dependencies = [ 547 | "libc", 548 | "num_threads", 549 | ] 550 | 551 | [[package]] 552 | name = "tinyvec" 553 | version = "1.6.0" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 556 | dependencies = [ 557 | "tinyvec_macros", 558 | ] 559 | 560 | [[package]] 561 | name = "tinyvec_macros" 562 | version = "0.1.0" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 565 | 566 | [[package]] 567 | name = "tokio" 568 | version = "1.20.1" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" 571 | dependencies = [ 572 | "autocfg", 573 | "bytes", 574 | "libc", 575 | "memchr", 576 | "mio", 577 | "num_cpus", 578 | "once_cell", 579 | "parking_lot", 580 | "pin-project-lite", 581 | "signal-hook-registry", 582 | "socket2", 583 | "tokio-macros", 584 | "winapi", 585 | ] 586 | 587 | [[package]] 588 | name = "tokio-macros" 589 | version = "1.8.0" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" 592 | dependencies = [ 593 | "proc-macro2", 594 | "quote", 595 | "syn", 596 | ] 597 | 598 | [[package]] 599 | name = "trust-dns-client" 600 | version = "0.21.2" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "a6d9ba1c6079f6f9b4664e482db1700bd53d2ee77b1c9752c1d7a66c0c8bda99" 603 | dependencies = [ 604 | "cfg-if", 605 | "data-encoding", 606 | "futures-channel", 607 | "futures-util", 608 | "lazy_static", 609 | "log", 610 | "radix_trie", 611 | "rand", 612 | "thiserror", 613 | "time", 614 | "tokio", 615 | "trust-dns-proto", 616 | ] 617 | 618 | [[package]] 619 | name = "trust-dns-proto" 620 | version = "0.21.2" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" 623 | dependencies = [ 624 | "async-trait", 625 | "cfg-if", 626 | "data-encoding", 627 | "enum-as-inner", 628 | "futures-channel", 629 | "futures-io", 630 | "futures-util", 631 | "idna", 632 | "ipnet", 633 | "lazy_static", 634 | "log", 635 | "rand", 636 | "smallvec", 637 | "thiserror", 638 | "tinyvec", 639 | "tokio", 640 | "url", 641 | ] 642 | 643 | [[package]] 644 | name = "unicode-bidi" 645 | version = "0.3.8" 646 | source = "registry+https://github.com/rust-lang/crates.io-index" 647 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 648 | 649 | [[package]] 650 | name = "unicode-ident" 651 | version = "1.0.3" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" 654 | 655 | [[package]] 656 | name = "unicode-normalization" 657 | version = "0.1.21" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" 660 | dependencies = [ 661 | "tinyvec", 662 | ] 663 | 664 | [[package]] 665 | name = "unicode-width" 666 | version = "0.1.9" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 669 | 670 | [[package]] 671 | name = "url" 672 | version = "2.2.2" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 675 | dependencies = [ 676 | "form_urlencoded", 677 | "idna", 678 | "matches", 679 | "percent-encoding", 680 | ] 681 | 682 | [[package]] 683 | name = "vec_map" 684 | version = "0.8.2" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 687 | 688 | [[package]] 689 | name = "wasi" 690 | version = "0.11.0+wasi-snapshot-preview1" 691 | source = "registry+https://github.com/rust-lang/crates.io-index" 692 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 693 | 694 | [[package]] 695 | name = "winapi" 696 | version = "0.3.9" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 699 | dependencies = [ 700 | "winapi-i686-pc-windows-gnu", 701 | "winapi-x86_64-pc-windows-gnu", 702 | ] 703 | 704 | [[package]] 705 | name = "winapi-i686-pc-windows-gnu" 706 | version = "0.4.0" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 709 | 710 | [[package]] 711 | name = "winapi-x86_64-pc-windows-gnu" 712 | version = "0.4.0" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 715 | 716 | [[package]] 717 | name = "windows-sys" 718 | version = "0.36.1" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 721 | dependencies = [ 722 | "windows_aarch64_msvc", 723 | "windows_i686_gnu", 724 | "windows_i686_msvc", 725 | "windows_x86_64_gnu", 726 | "windows_x86_64_msvc", 727 | ] 728 | 729 | [[package]] 730 | name = "windows_aarch64_msvc" 731 | version = "0.36.1" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 734 | 735 | [[package]] 736 | name = "windows_i686_gnu" 737 | version = "0.36.1" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 740 | 741 | [[package]] 742 | name = "windows_i686_msvc" 743 | version = "0.36.1" 744 | source = "registry+https://github.com/rust-lang/crates.io-index" 745 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 746 | 747 | [[package]] 748 | name = "windows_x86_64_gnu" 749 | version = "0.36.1" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 752 | 753 | [[package]] 754 | name = "windows_x86_64_msvc" 755 | version = "0.36.1" 756 | source = "registry+https://github.com/rust-lang/crates.io-index" 757 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 758 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "subdomains_brute" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | trust-dns-client = "*" 10 | tokio = { version = "1.17.0", features = ["full"] } 11 | futures = "0.3" 12 | trust-dns-proto="*" 13 | clap = "2.33" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # subdomain brutforce in rust ![GitHub last commit](https://img.shields.io/github/last-commit/hazemeldoc/subdomain-brute?style=plastic) 6 | 7 | > an active subdomain enum tool based on research on [NOERROR & NODATA](https://www.securesystems.de/blog/enhancing-subdomain-enumeration-ents-and-noerror/) 8 | 9 | a simple multithreaded tool to preform active domain enumeration, unlike some other tools this tool doesn't ignore NODATA responses returned from DNS server instead it add them to queue to re-scan them 10 | 11 | ## ENT 12 | 13 | also known as empty non-terminals , this response is the result of the following scenario 14 | -we have a domain called example.com 15 | -then we decided to add a subdomain called blog.dev.example.com 16 | -despite not adding a dev.example.com entry it's automatically created 17 | -in this case dev.example.com return NODATA response 18 | 19 | 20 | 21 | >in order to make out the most of this tool always use -r option which will rescan ENT (if it found dev.example.com (ENT) it will bruteforce it again which will result in finding blog.dev.example.com 22 | 23 | ## usage 24 | 25 | ``` 26 | USAGE: 27 | subdomains_brute [FLAGS] 28 | 29 | FLAGS: 30 | -w, --wordlist the path to wordlist 31 | -c, --Concurrency the number of concurent requests 32 | -r, --recursive re-scan ENT nodes 33 | 34 | ARGS: 35 | The target to scan (e.g:google.com) 36 | ``` 37 | 38 | ## DNS 39 | 40 | -the script use cloudflare DNS server 41 | 42 | ![code_snippet](https://raw.githubusercontent.com/hazemeldoc/subdomain-brute/master/img/code.svg) 43 | 44 | but you could change this to desired DNS server by changing the ip in this code snippet and it should work fine 45 | 46 | ## installation 47 | ``` 48 | git clone https://github.com/hazemeldoc/subdomain-brute.git 49 | cd subdomain-brute 50 | cargo build >> you migh get some warnings during build kindly ignore them 51 | ``` 52 | 53 | ## sample run 54 | ![RUN](https://github.com/hazemeldoc/subdomain-brute/raw/master/img/github.gif) 55 | -------------------------------------------------------------------------------- /img/DNS_hierarchy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hazemeldoc/subdomain-brute/96970ef9dfff605d4b75da6ba776cce0e37f3008/img/DNS_hierarchy.png -------------------------------------------------------------------------------- /img/github.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hazemeldoc/subdomain-brute/96970ef9dfff605d4b75da6ba776cce0e37f3008/img/github.gif -------------------------------------------------------------------------------- /img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 29 | 41 | 45 | 49 | 53 | 57 | 62 | 65 | 69 | 70 | 73 | 77 | 84 | 86 | 90 | 94 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 106 | 108 | 112 | 116 | 120 | 124 | 128 | 129 | 130 | 133 | 137 | 141 | 145 | 149 | 153 | 157 | 161 | 165 | 169 | 173 | 177 | 181 | 185 | 189 | 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /src/dns_query.rs: -------------------------------------------------------------------------------- 1 | use std::str::FromStr; 2 | use trust_dns_client::client::{AsyncClient, ClientHandle}; 3 | use trust_dns_client::rr::{DNSClass, Name, RecordType}; 4 | use trust_dns_proto::op::response_code::ResponseCode; 5 | 6 | use crate::race_cond; 7 | use crate::ENT; 8 | 9 | pub async fn dns_q(mut client: AsyncClient, subdomain: String) { 10 | // Specify the name, note the final '.' which specifies it's an FQDN 11 | let name = Name::from_str(&subdomain).unwrap_or(Name::from_str("NULL").unwrap()); 12 | if name.to_string() == "NULL" { 13 | return; 14 | } 15 | let query = client.query(name, DNSClass::IN, RecordType::A); 16 | let response = query.await.unwrap(); 17 | let answers = response.response_code(); 18 | let answer2 = response.answers(); 19 | if answers != ResponseCode::NXDomain { 20 | if answer2.len() == 0 { 21 | unsafe { 22 | while race_cond != 1 { 23 | //println!("inrace"); 24 | race_cond = 1; 25 | ENT.push(subdomain.clone()); 26 | //println!("pushed"); 27 | race_cond = 0; 28 | //println!("exit race"); 29 | break; 30 | } 31 | } 32 | } else { 33 | println!("{}", subdomain); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/file_read.rs: -------------------------------------------------------------------------------- 1 | use std::fs::File; 2 | use std::io::BufRead; 3 | use std::io::BufReader; 4 | pub fn read_file_line_by_line( 5 | filepath: &str, 6 | vec: &mut Vec, 7 | domain: &str, 8 | ) -> Result<(), Box> { 9 | let file = match File::open(filepath) { 10 | Ok(f) => f, 11 | Err(err) => panic!("unable to read from file error:{}", err.to_string()), 12 | }; 13 | 14 | let reader = BufReader::new(file); 15 | 16 | for line in reader.lines() { 17 | let mut x = line.unwrap().to_string(); 18 | x.push_str("."); 19 | x.push_str(domain); 20 | vec.push(x); 21 | } 22 | Ok(()) 23 | } 24 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::{App, Arg}; 2 | use futures::{stream, StreamExt}; 3 | use tokio::net::TcpStream as TokioTcpStream; 4 | use trust_dns_client::client::AsyncClient; 5 | use trust_dns_client::proto::iocompat::AsyncIoTokioAsStd; 6 | use trust_dns_client::tcp::TcpClientStream; 7 | 8 | mod dns_query; 9 | mod file_read; 10 | 11 | static mut ENT: Vec = vec![]; 12 | static mut race_cond: i8 = 0; 13 | 14 | #[tokio::main] 15 | async fn main() { 16 | let param = App::new(clap::crate_name!()) 17 | .version(clap::crate_version!()) 18 | .about(clap::crate_description!()) 19 | .arg( 20 | Arg::with_name("domain") 21 | .help("domain to preform bruteforce on") 22 | .short("d") 23 | .required(true) 24 | .index(1), 25 | ) 26 | .arg( 27 | Arg::with_name("concurrency") 28 | .help("Concurrency") 29 | .long("concurrency") 30 | .short("c") 31 | .default_value("20"), 32 | ) 33 | .arg( 34 | Arg::with_name("wordlist") 35 | .help("wordlist path") 36 | .long("wordlist") 37 | .short("w") 38 | .takes_value(true), 39 | ) 40 | .arg( 41 | Arg::with_name("recursive") 42 | .long("recursive") 43 | .required(false) 44 | .takes_value(false) 45 | .short("r") 46 | .help("bruteforce on ENT entities"), 47 | ) 48 | .setting(clap::AppSettings::ArgRequiredElseHelp) 49 | .setting(clap::AppSettings::VersionlessSubcommands) 50 | .get_matches(); 51 | 52 | let concurrency = param 53 | .value_of("concurrency") 54 | .unwrap() 55 | .parse::() 56 | .unwrap_or(20); 57 | let domain = param.value_of("domain").unwrap(); 58 | let wordlist = param.value_of("wordlist").unwrap(); 59 | 60 | let mut queue_: Vec = vec![]; 61 | file_read::read_file_line_by_line(wordlist, &mut queue_, domain); 62 | 63 | /* 64 | let (stream, sender) = 65 | TcpClientStream::>::new(([8, 8, 8, 8], 53).into()); 66 | let client = AsyncClient::new(stream, sender, None); 67 | let (mut client, bg) = client.await.expect("connection failed"); 68 | tokio::spawn(bg); 69 | //9.9.9.9 70 | //109.228.47.218 71 | */ 72 | let (stream, sender) = 73 | TcpClientStream::>::new(([1, 1, 1, 1], 53).into()); 74 | let client2 = AsyncClient::new(stream, sender, None); 75 | let (client2, bg2) = client2.await.expect("connection failed"); 76 | tokio::spawn(bg2); 77 | 78 | let q = stream::iter(queue_.clone()); 79 | 80 | q.for_each_concurrent(concurrency, |subdomain| { 81 | dns_query::dns_q(client2.clone(), subdomain.to_string()) 82 | }) 83 | .await; 84 | 85 | unsafe { 86 | if race_cond == 0 { 87 | println!("--------------------------------------------ENT------------------------------------------------"); 88 | race_cond = 1; 89 | for _i in 0..ENT.len() { 90 | let ent = ENT.pop().unwrap(); 91 | println!("{}", ent); 92 | if param.is_present("recursive") { 93 | queue_ = vec![]; 94 | file_read::read_file_line_by_line(wordlist, &mut queue_, &ent); 95 | let q = stream::iter(queue_.clone()); 96 | q.for_each_concurrent(concurrency, |subdomain| { 97 | dns_query::dns_q(client2.clone(), subdomain.to_string()) 98 | }) 99 | .await; 100 | } 101 | } 102 | race_cond = 0; 103 | } 104 | } 105 | } 106 | --------------------------------------------------------------------------------