├── .github └── FUNDING.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md └── src └── main.rs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ['paypal.me/elbadry9', 'buymeacoffee.com/melbadry9'] 4 | -------------------------------------------------------------------------------- /.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 = "addr" 7 | version = "0.14.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "c54ccac949a2afafdfc889e15c753bbc6ee8783e026bbe3d057b00b13907db70" 10 | dependencies = [ 11 | "psl", 12 | "psl-types", 13 | ] 14 | 15 | [[package]] 16 | name = "ansi_term" 17 | version = "0.12.1" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 20 | dependencies = [ 21 | "winapi", 22 | ] 23 | 24 | [[package]] 25 | name = "atty" 26 | version = "0.2.14" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 29 | dependencies = [ 30 | "hermit-abi", 31 | "libc", 32 | "winapi", 33 | ] 34 | 35 | [[package]] 36 | name = "autocfg" 37 | version = "1.0.1" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 40 | 41 | [[package]] 42 | name = "base64" 43 | version = "0.13.0" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 46 | 47 | [[package]] 48 | name = "bitflags" 49 | version = "1.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 52 | 53 | [[package]] 54 | name = "bumpalo" 55 | version = "3.9.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" 58 | 59 | [[package]] 60 | name = "bytes" 61 | version = "1.1.0" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 64 | 65 | [[package]] 66 | name = "cc" 67 | version = "1.0.72" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" 70 | 71 | [[package]] 72 | name = "cfg-if" 73 | version = "1.0.0" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 76 | 77 | [[package]] 78 | name = "clap" 79 | version = "2.34.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 82 | dependencies = [ 83 | "ansi_term", 84 | "atty", 85 | "bitflags", 86 | "strsim", 87 | "textwrap", 88 | "unicode-width", 89 | "vec_map", 90 | ] 91 | 92 | [[package]] 93 | name = "core-foundation" 94 | version = "0.9.2" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" 97 | dependencies = [ 98 | "core-foundation-sys", 99 | "libc", 100 | ] 101 | 102 | [[package]] 103 | name = "core-foundation-sys" 104 | version = "0.8.3" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 107 | 108 | [[package]] 109 | name = "encoding_rs" 110 | version = "0.8.30" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" 113 | dependencies = [ 114 | "cfg-if", 115 | ] 116 | 117 | [[package]] 118 | name = "fastrand" 119 | version = "1.7.0" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" 122 | dependencies = [ 123 | "instant", 124 | ] 125 | 126 | [[package]] 127 | name = "fnv" 128 | version = "1.0.7" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 131 | 132 | [[package]] 133 | name = "foreign-types" 134 | version = "0.3.2" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 137 | dependencies = [ 138 | "foreign-types-shared", 139 | ] 140 | 141 | [[package]] 142 | name = "foreign-types-shared" 143 | version = "0.1.1" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 146 | 147 | [[package]] 148 | name = "form_urlencoded" 149 | version = "1.0.1" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 152 | dependencies = [ 153 | "matches", 154 | "percent-encoding", 155 | ] 156 | 157 | [[package]] 158 | name = "futures-channel" 159 | version = "0.3.19" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" 162 | dependencies = [ 163 | "futures-core", 164 | ] 165 | 166 | [[package]] 167 | name = "futures-core" 168 | version = "0.3.19" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" 171 | 172 | [[package]] 173 | name = "futures-sink" 174 | version = "0.3.19" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" 177 | 178 | [[package]] 179 | name = "futures-task" 180 | version = "0.3.19" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" 183 | 184 | [[package]] 185 | name = "futures-util" 186 | version = "0.3.19" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" 189 | dependencies = [ 190 | "futures-core", 191 | "futures-task", 192 | "pin-project-lite", 193 | "pin-utils", 194 | ] 195 | 196 | [[package]] 197 | name = "h2" 198 | version = "0.3.11" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" 201 | dependencies = [ 202 | "bytes", 203 | "fnv", 204 | "futures-core", 205 | "futures-sink", 206 | "futures-util", 207 | "http", 208 | "indexmap", 209 | "slab", 210 | "tokio", 211 | "tokio-util", 212 | "tracing", 213 | ] 214 | 215 | [[package]] 216 | name = "hashbrown" 217 | version = "0.11.2" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 220 | 221 | [[package]] 222 | name = "hermit-abi" 223 | version = "0.1.19" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 226 | dependencies = [ 227 | "libc", 228 | ] 229 | 230 | [[package]] 231 | name = "http" 232 | version = "0.2.6" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" 235 | dependencies = [ 236 | "bytes", 237 | "fnv", 238 | "itoa 1.0.1", 239 | ] 240 | 241 | [[package]] 242 | name = "http-body" 243 | version = "0.4.4" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" 246 | dependencies = [ 247 | "bytes", 248 | "http", 249 | "pin-project-lite", 250 | ] 251 | 252 | [[package]] 253 | name = "httparse" 254 | version = "1.5.1" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" 257 | 258 | [[package]] 259 | name = "httpdate" 260 | version = "1.0.2" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 263 | 264 | [[package]] 265 | name = "hyper" 266 | version = "0.14.16" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" 269 | dependencies = [ 270 | "bytes", 271 | "futures-channel", 272 | "futures-core", 273 | "futures-util", 274 | "h2", 275 | "http", 276 | "http-body", 277 | "httparse", 278 | "httpdate", 279 | "itoa 0.4.8", 280 | "pin-project-lite", 281 | "socket2", 282 | "tokio", 283 | "tower-service", 284 | "tracing", 285 | "want", 286 | ] 287 | 288 | [[package]] 289 | name = "hyper-tls" 290 | version = "0.5.0" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 293 | dependencies = [ 294 | "bytes", 295 | "hyper", 296 | "native-tls", 297 | "tokio", 298 | "tokio-native-tls", 299 | ] 300 | 301 | [[package]] 302 | name = "idna" 303 | version = "0.2.3" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 306 | dependencies = [ 307 | "matches", 308 | "unicode-bidi", 309 | "unicode-normalization", 310 | ] 311 | 312 | [[package]] 313 | name = "indexmap" 314 | version = "1.8.0" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" 317 | dependencies = [ 318 | "autocfg", 319 | "hashbrown", 320 | ] 321 | 322 | [[package]] 323 | name = "instant" 324 | version = "0.1.12" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 327 | dependencies = [ 328 | "cfg-if", 329 | ] 330 | 331 | [[package]] 332 | name = "ipnet" 333 | version = "2.3.1" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" 336 | 337 | [[package]] 338 | name = "itoa" 339 | version = "0.4.8" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" 342 | 343 | [[package]] 344 | name = "itoa" 345 | version = "1.0.1" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 348 | 349 | [[package]] 350 | name = "js-sys" 351 | version = "0.3.56" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" 354 | dependencies = [ 355 | "wasm-bindgen", 356 | ] 357 | 358 | [[package]] 359 | name = "lazy_static" 360 | version = "1.4.0" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 363 | 364 | [[package]] 365 | name = "libc" 366 | version = "0.2.116" 367 | source = "registry+https://github.com/rust-lang/crates.io-index" 368 | checksum = "565dbd88872dbe4cc8a46e527f26483c1d1f7afa6b884a3bd6cd893d4f98da74" 369 | 370 | [[package]] 371 | name = "log" 372 | version = "0.4.14" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 375 | dependencies = [ 376 | "cfg-if", 377 | ] 378 | 379 | [[package]] 380 | name = "matches" 381 | version = "0.1.9" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 384 | 385 | [[package]] 386 | name = "memchr" 387 | version = "2.4.1" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 390 | 391 | [[package]] 392 | name = "mime" 393 | version = "0.3.16" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 396 | 397 | [[package]] 398 | name = "mio" 399 | version = "0.7.14" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" 402 | dependencies = [ 403 | "libc", 404 | "log", 405 | "miow", 406 | "ntapi", 407 | "winapi", 408 | ] 409 | 410 | [[package]] 411 | name = "miow" 412 | version = "0.3.7" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 415 | dependencies = [ 416 | "winapi", 417 | ] 418 | 419 | [[package]] 420 | name = "native-tls" 421 | version = "0.2.8" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" 424 | dependencies = [ 425 | "lazy_static", 426 | "libc", 427 | "log", 428 | "openssl", 429 | "openssl-probe", 430 | "openssl-sys", 431 | "schannel", 432 | "security-framework", 433 | "security-framework-sys", 434 | "tempfile", 435 | ] 436 | 437 | [[package]] 438 | name = "ntapi" 439 | version = "0.3.6" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 442 | dependencies = [ 443 | "winapi", 444 | ] 445 | 446 | [[package]] 447 | name = "num_cpus" 448 | version = "1.13.1" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 451 | dependencies = [ 452 | "hermit-abi", 453 | "libc", 454 | ] 455 | 456 | [[package]] 457 | name = "once_cell" 458 | version = "1.9.0" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" 461 | 462 | [[package]] 463 | name = "openssl" 464 | version = "0.10.38" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" 467 | dependencies = [ 468 | "bitflags", 469 | "cfg-if", 470 | "foreign-types", 471 | "libc", 472 | "once_cell", 473 | "openssl-sys", 474 | ] 475 | 476 | [[package]] 477 | name = "openssl-probe" 478 | version = "0.1.5" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 481 | 482 | [[package]] 483 | name = "openssl-src" 484 | version = "111.22.0+1.1.1q" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853" 487 | dependencies = [ 488 | "cc", 489 | ] 490 | 491 | [[package]] 492 | name = "openssl-sys" 493 | version = "0.9.72" 494 | source = "registry+https://github.com/rust-lang/crates.io-index" 495 | checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" 496 | dependencies = [ 497 | "autocfg", 498 | "cc", 499 | "libc", 500 | "openssl-src", 501 | "pkg-config", 502 | "vcpkg", 503 | ] 504 | 505 | [[package]] 506 | name = "percent-encoding" 507 | version = "2.1.0" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 510 | 511 | [[package]] 512 | name = "pin-project-lite" 513 | version = "0.2.8" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" 516 | 517 | [[package]] 518 | name = "pin-utils" 519 | version = "0.1.0" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 522 | 523 | [[package]] 524 | name = "pkg-config" 525 | version = "0.3.24" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" 528 | 529 | [[package]] 530 | name = "proc-macro2" 531 | version = "1.0.36" 532 | source = "registry+https://github.com/rust-lang/crates.io-index" 533 | checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" 534 | dependencies = [ 535 | "unicode-xid", 536 | ] 537 | 538 | [[package]] 539 | name = "psl" 540 | version = "2.0.68" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "e79aa44cc533d61f86c21482e836c65416c2ced939bae5a01581719c622f84bf" 543 | dependencies = [ 544 | "psl-types", 545 | ] 546 | 547 | [[package]] 548 | name = "psl-types" 549 | version = "2.0.10" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "e8eda7c62d9ecaafdf8b62374c006de0adf61666ae96a96ba74a37134aa4e470" 552 | 553 | [[package]] 554 | name = "quote" 555 | version = "1.0.15" 556 | source = "registry+https://github.com/rust-lang/crates.io-index" 557 | checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" 558 | dependencies = [ 559 | "proc-macro2", 560 | ] 561 | 562 | [[package]] 563 | name = "redox_syscall" 564 | version = "0.2.10" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 567 | dependencies = [ 568 | "bitflags", 569 | ] 570 | 571 | [[package]] 572 | name = "remove_dir_all" 573 | version = "0.5.3" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 576 | dependencies = [ 577 | "winapi", 578 | ] 579 | 580 | [[package]] 581 | name = "reqwest" 582 | version = "0.11.9" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" 585 | dependencies = [ 586 | "base64", 587 | "bytes", 588 | "encoding_rs", 589 | "futures-core", 590 | "futures-util", 591 | "h2", 592 | "http", 593 | "http-body", 594 | "hyper", 595 | "hyper-tls", 596 | "ipnet", 597 | "js-sys", 598 | "lazy_static", 599 | "log", 600 | "mime", 601 | "native-tls", 602 | "percent-encoding", 603 | "pin-project-lite", 604 | "serde", 605 | "serde_json", 606 | "serde_urlencoded", 607 | "tokio", 608 | "tokio-native-tls", 609 | "url", 610 | "wasm-bindgen", 611 | "wasm-bindgen-futures", 612 | "web-sys", 613 | "winreg", 614 | ] 615 | 616 | [[package]] 617 | name = "ryu" 618 | version = "1.0.9" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 621 | 622 | [[package]] 623 | name = "schannel" 624 | version = "0.1.19" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 627 | dependencies = [ 628 | "lazy_static", 629 | "winapi", 630 | ] 631 | 632 | [[package]] 633 | name = "security-framework" 634 | version = "2.6.0" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "3fed7948b6c68acbb6e20c334f55ad635dc0f75506963de4464289fbd3b051ac" 637 | dependencies = [ 638 | "bitflags", 639 | "core-foundation", 640 | "core-foundation-sys", 641 | "libc", 642 | "security-framework-sys", 643 | ] 644 | 645 | [[package]] 646 | name = "security-framework-sys" 647 | version = "2.6.0" 648 | source = "registry+https://github.com/rust-lang/crates.io-index" 649 | checksum = "a57321bf8bc2362081b2599912d2961fe899c0efadf1b4b2f8d48b3e253bb96c" 650 | dependencies = [ 651 | "core-foundation-sys", 652 | "libc", 653 | ] 654 | 655 | [[package]] 656 | name = "serde" 657 | version = "1.0.136" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" 660 | dependencies = [ 661 | "serde_derive", 662 | ] 663 | 664 | [[package]] 665 | name = "serde_derive" 666 | version = "1.0.136" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" 669 | dependencies = [ 670 | "proc-macro2", 671 | "quote", 672 | "syn", 673 | ] 674 | 675 | [[package]] 676 | name = "serde_json" 677 | version = "1.0.78" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" 680 | dependencies = [ 681 | "itoa 1.0.1", 682 | "ryu", 683 | "serde", 684 | ] 685 | 686 | [[package]] 687 | name = "serde_urlencoded" 688 | version = "0.7.1" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 691 | dependencies = [ 692 | "form_urlencoded", 693 | "itoa 1.0.1", 694 | "ryu", 695 | "serde", 696 | ] 697 | 698 | [[package]] 699 | name = "slab" 700 | version = "0.4.5" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" 703 | 704 | [[package]] 705 | name = "socket2" 706 | version = "0.4.4" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" 709 | dependencies = [ 710 | "libc", 711 | "winapi", 712 | ] 713 | 714 | [[package]] 715 | name = "sslenum" 716 | version = "1.0.2" 717 | dependencies = [ 718 | "addr", 719 | "clap", 720 | "openssl", 721 | "openssl-probe", 722 | "reqwest", 723 | "serde", 724 | "serde_derive", 725 | "serde_json", 726 | "threadpool", 727 | ] 728 | 729 | [[package]] 730 | name = "strsim" 731 | version = "0.8.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 734 | 735 | [[package]] 736 | name = "syn" 737 | version = "1.0.86" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" 740 | dependencies = [ 741 | "proc-macro2", 742 | "quote", 743 | "unicode-xid", 744 | ] 745 | 746 | [[package]] 747 | name = "tempfile" 748 | version = "3.3.0" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 751 | dependencies = [ 752 | "cfg-if", 753 | "fastrand", 754 | "libc", 755 | "redox_syscall", 756 | "remove_dir_all", 757 | "winapi", 758 | ] 759 | 760 | [[package]] 761 | name = "textwrap" 762 | version = "0.11.0" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 765 | dependencies = [ 766 | "unicode-width", 767 | ] 768 | 769 | [[package]] 770 | name = "threadpool" 771 | version = "1.8.1" 772 | source = "registry+https://github.com/rust-lang/crates.io-index" 773 | checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" 774 | dependencies = [ 775 | "num_cpus", 776 | ] 777 | 778 | [[package]] 779 | name = "tinyvec" 780 | version = "1.5.1" 781 | source = "registry+https://github.com/rust-lang/crates.io-index" 782 | checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" 783 | dependencies = [ 784 | "tinyvec_macros", 785 | ] 786 | 787 | [[package]] 788 | name = "tinyvec_macros" 789 | version = "0.1.0" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 792 | 793 | [[package]] 794 | name = "tokio" 795 | version = "1.16.1" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" 798 | dependencies = [ 799 | "bytes", 800 | "libc", 801 | "memchr", 802 | "mio", 803 | "pin-project-lite", 804 | "winapi", 805 | ] 806 | 807 | [[package]] 808 | name = "tokio-native-tls" 809 | version = "0.3.0" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 812 | dependencies = [ 813 | "native-tls", 814 | "tokio", 815 | ] 816 | 817 | [[package]] 818 | name = "tokio-util" 819 | version = "0.6.9" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" 822 | dependencies = [ 823 | "bytes", 824 | "futures-core", 825 | "futures-sink", 826 | "log", 827 | "pin-project-lite", 828 | "tokio", 829 | ] 830 | 831 | [[package]] 832 | name = "tower-service" 833 | version = "0.3.1" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 836 | 837 | [[package]] 838 | name = "tracing" 839 | version = "0.1.29" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" 842 | dependencies = [ 843 | "cfg-if", 844 | "pin-project-lite", 845 | "tracing-core", 846 | ] 847 | 848 | [[package]] 849 | name = "tracing-core" 850 | version = "0.1.21" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" 853 | dependencies = [ 854 | "lazy_static", 855 | ] 856 | 857 | [[package]] 858 | name = "try-lock" 859 | version = "0.2.3" 860 | source = "registry+https://github.com/rust-lang/crates.io-index" 861 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 862 | 863 | [[package]] 864 | name = "unicode-bidi" 865 | version = "0.3.7" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" 868 | 869 | [[package]] 870 | name = "unicode-normalization" 871 | version = "0.1.19" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 874 | dependencies = [ 875 | "tinyvec", 876 | ] 877 | 878 | [[package]] 879 | name = "unicode-width" 880 | version = "0.1.9" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 883 | 884 | [[package]] 885 | name = "unicode-xid" 886 | version = "0.2.2" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 889 | 890 | [[package]] 891 | name = "url" 892 | version = "2.2.2" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 895 | dependencies = [ 896 | "form_urlencoded", 897 | "idna", 898 | "matches", 899 | "percent-encoding", 900 | ] 901 | 902 | [[package]] 903 | name = "vcpkg" 904 | version = "0.2.15" 905 | source = "registry+https://github.com/rust-lang/crates.io-index" 906 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 907 | 908 | [[package]] 909 | name = "vec_map" 910 | version = "0.8.2" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 913 | 914 | [[package]] 915 | name = "want" 916 | version = "0.3.0" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 919 | dependencies = [ 920 | "log", 921 | "try-lock", 922 | ] 923 | 924 | [[package]] 925 | name = "wasm-bindgen" 926 | version = "0.2.79" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" 929 | dependencies = [ 930 | "cfg-if", 931 | "wasm-bindgen-macro", 932 | ] 933 | 934 | [[package]] 935 | name = "wasm-bindgen-backend" 936 | version = "0.2.79" 937 | source = "registry+https://github.com/rust-lang/crates.io-index" 938 | checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" 939 | dependencies = [ 940 | "bumpalo", 941 | "lazy_static", 942 | "log", 943 | "proc-macro2", 944 | "quote", 945 | "syn", 946 | "wasm-bindgen-shared", 947 | ] 948 | 949 | [[package]] 950 | name = "wasm-bindgen-futures" 951 | version = "0.4.29" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" 954 | dependencies = [ 955 | "cfg-if", 956 | "js-sys", 957 | "wasm-bindgen", 958 | "web-sys", 959 | ] 960 | 961 | [[package]] 962 | name = "wasm-bindgen-macro" 963 | version = "0.2.79" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" 966 | dependencies = [ 967 | "quote", 968 | "wasm-bindgen-macro-support", 969 | ] 970 | 971 | [[package]] 972 | name = "wasm-bindgen-macro-support" 973 | version = "0.2.79" 974 | source = "registry+https://github.com/rust-lang/crates.io-index" 975 | checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" 976 | dependencies = [ 977 | "proc-macro2", 978 | "quote", 979 | "syn", 980 | "wasm-bindgen-backend", 981 | "wasm-bindgen-shared", 982 | ] 983 | 984 | [[package]] 985 | name = "wasm-bindgen-shared" 986 | version = "0.2.79" 987 | source = "registry+https://github.com/rust-lang/crates.io-index" 988 | checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" 989 | 990 | [[package]] 991 | name = "web-sys" 992 | version = "0.3.56" 993 | source = "registry+https://github.com/rust-lang/crates.io-index" 994 | checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" 995 | dependencies = [ 996 | "js-sys", 997 | "wasm-bindgen", 998 | ] 999 | 1000 | [[package]] 1001 | name = "winapi" 1002 | version = "0.3.9" 1003 | source = "registry+https://github.com/rust-lang/crates.io-index" 1004 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1005 | dependencies = [ 1006 | "winapi-i686-pc-windows-gnu", 1007 | "winapi-x86_64-pc-windows-gnu", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "winapi-i686-pc-windows-gnu" 1012 | version = "0.4.0" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1015 | 1016 | [[package]] 1017 | name = "winapi-x86_64-pc-windows-gnu" 1018 | version = "0.4.0" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1021 | 1022 | [[package]] 1023 | name = "winreg" 1024 | version = "0.7.0" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" 1027 | dependencies = [ 1028 | "winapi", 1029 | ] 1030 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sslenum" 3 | version = "1.0.2" 4 | authors = ["melbadry9 "] 5 | edition = "2018" 6 | description = "SSL certificate Extractor" 7 | documentation = "https://github.com/melbadry9/sslenum" 8 | repository = "https://github.com/melbadry9/sslenum" 9 | license = "MIT OR Apache-2.0" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | #native-tls = "0.2.7" 15 | openssl = { version = "0.10.34", features = ["vendored"] } 16 | reqwest = "0.11.3" 17 | addr = "0.14.0" 18 | clap = "2.33.3" 19 | threadpool = "1.8.1" 20 | serde_json = "1.0.59" 21 | serde = { version = "1.0.126", features = ["derive"] } 22 | serde_derive = "1.0.126" 23 | openssl-probe = "0.1.2" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SSLEnum 2 | 3 | Extract SSL certificate data (Subject Name, Subject Alt Names, Organisation) 4 | 5 | ## Install 6 | 7 | - Install from `crates.io` 8 | ```bash 9 | cargo install sslenum --force 10 | ``` 11 | 12 | - Intall from `github` 13 | ```bash 14 | git clone https://github.com/melbadry9/SSLEnum.git 15 | cd SSLEnum 16 | cargo install --path . 17 | ``` 18 | 19 | ## Usage 20 | 21 | - Help 22 | 23 | ```txt 24 | SSLEnum [SSL Data Enumeration] 1.0.1 25 | Mohamed Elbadry 26 | 27 | USAGE: 28 | sslenum [OPTIONS] 29 | 30 | FLAGS: 31 | -h, --help Prints help information 32 | -V, --version Prints version information 33 | 34 | OPTIONS: 35 | -d, --domain Sets domain to check 36 | -p, --port Sets port number [default: 443] 37 | -t, --threads Sets number of threads [default: 5] 38 | ``` 39 | 40 | ```bash 41 | $ cat subdomains.list | sslenum -t 5 -p 443 42 | $ sslenum -d example.com | jq 43 | ```` 44 | 45 | - Output 46 | 47 | ```json 48 | { 49 | "hostname": "example.com", 50 | "ip": "93.184.216.34", 51 | "org": [ 52 | "Internet Corporation for Assigned Names and Numbers" 53 | ], 54 | "cn": [ 55 | "www.example.org" 56 | ], 57 | "alt_names": [ 58 | "www.example.org", 59 | "example.com", 60 | "example.edu", 61 | "example.net", 62 | "example.org", 63 | "www.example.com", 64 | "www.example.edu", 65 | "www.example.net" 66 | ], 67 | "dangling": false 68 | } 69 | ``` 70 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use addr::parser::DnsName; 2 | use addr::psl::List; 3 | use clap::{value_t, App, Arg}; 4 | use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode}; 5 | use openssl::stack::StackRef; 6 | use openssl::x509::{X509Ref, X509}; 7 | use openssl_probe; 8 | use serde::{Deserialize, Serialize}; 9 | use std::io::{self, BufRead}; 10 | use std::net::{TcpStream, ToSocketAddrs}; 11 | use std::time::Duration; 12 | use threadpool::ThreadPool; 13 | 14 | #[derive(Serialize, Deserialize, Debug)] 15 | struct DomainData { 16 | hostname: String, 17 | ip: String, 18 | org: Vec, 19 | cn: Vec, 20 | alt_names: Vec, 21 | dangling: bool, 22 | } 23 | 24 | impl DomainData { 25 | fn check_dangling(self: &mut Self) { 26 | let domain = List.parse_dns_name(self.hostname.as_str()).unwrap(); 27 | let mut dns_names: Vec = Vec::new(); 28 | 29 | dns_names.extend(self.cn.clone()); 30 | dns_names.extend(self.alt_names.clone()); 31 | 32 | for cand in dns_names { 33 | let cleaned_cand = &cand.clone().to_lowercase(); 34 | let host = List.parse_dns_name(cleaned_cand.as_str()); 35 | match host { 36 | Ok(host) => { 37 | let host_root = host.root(); 38 | match host_root { 39 | Some(host_root) => { 40 | if !(domain.root().unwrap() == host_root) { 41 | self.dangling = true; 42 | } else { 43 | self.dangling = false; 44 | break; 45 | } 46 | } 47 | None => { 48 | self.dangling = true; 49 | } 50 | } 51 | } 52 | Err(_) => { 53 | self.dangling = false; 54 | } 55 | } 56 | 57 | } 58 | 59 | } 60 | } 61 | 62 | fn make_connection(domain: String, port: String) { 63 | let tmp_dom = domain.clone(); 64 | let mut connector = SslConnector::builder(SslMethod::tls_client()).unwrap(); 65 | connector.set_verify(SslVerifyMode::NONE); 66 | 67 | let conn = connector.build(); 68 | conn.configure() 69 | .unwrap() 70 | .use_server_name_indication(true) 71 | .verify_hostname(true); 72 | 73 | let con_string = format!("{}:{}", domain, &port); 74 | let con_addrs = con_string.to_socket_addrs(); 75 | match con_addrs { 76 | Ok(con_addrs) => { 77 | for ip in con_addrs { 78 | let tt = TcpStream::connect_timeout(&ip, Duration::from_secs(2)); 79 | let ex_cert = extract_ssl(&tt, &conn, &tmp_dom.as_str()); 80 | match ex_cert { 81 | Ok(ex_cert) => { 82 | let cn = get_value("cn", &ex_cert); 83 | let org = get_value("org", &ex_cert); 84 | let alt_names = get_value("doms", &ex_cert); 85 | 86 | let mut ch_domain = DomainData { 87 | hostname: tmp_dom.to_string().to_lowercase(), 88 | ip: ip.ip().to_string(), 89 | org, 90 | cn, 91 | alt_names, 92 | dangling: false, 93 | }; 94 | ch_domain.check_dangling(); 95 | let ser_domain = serde_json::to_string(&ch_domain).unwrap(); 96 | 97 | println!("{}", ser_domain); 98 | } 99 | Err(_) => { 100 | //eprintln!("SSL/TLS not enabled on: {}:{}", &dom, &port); 101 | } 102 | }; 103 | } 104 | } 105 | Err(_) => {} 106 | } 107 | } 108 | 109 | fn extract_ssl(stream: &Result, conn: &SslConnector, domain: &str,) -> Result { 110 | match stream { 111 | Ok(stream) => { 112 | let _ = stream 113 | .set_read_timeout(Some(Duration::from_secs(2))) 114 | .unwrap(); 115 | let _ = stream 116 | .set_write_timeout(Some(Duration::from_secs(2))) 117 | .unwrap(); 118 | let stream = conn.connect(&domain, stream); 119 | match stream { 120 | Ok(stream) => { 121 | let cert_stack: &StackRef = stream.ssl().peer_cert_chain().unwrap(); 122 | let certs: Vec = cert_stack.iter().map(X509Ref::to_owned).collect(); 123 | Ok(certs[0].to_owned()) 124 | } 125 | Err(_) => { 126 | //eprintln!("{}", e.to_string()); 127 | Err(()) 128 | } 129 | } 130 | } 131 | Err(_) => Err(()), 132 | } 133 | } 134 | 135 | fn get_value>(n: &str, cert: &R) -> Vec { 136 | let cert = cert.as_ref(); 137 | if n == "cn" { 138 | let try_common_names: Vec<_> = cert 139 | .subject_name() 140 | .entries_by_nid(openssl::nid::Nid::COMMONNAME) 141 | .map(|x| x.data().as_utf8()) 142 | .collect(); 143 | 144 | let mut common_names: Vec = Vec::with_capacity(try_common_names.len()); 145 | for cn in try_common_names { 146 | if let Err(ref e) = cn { 147 | println!("While parsing common name: {}", &e); 148 | } 149 | common_names.push(String::from(AsRef::::as_ref(&cn.unwrap()))); 150 | } 151 | common_names 152 | } else if n == "org" { 153 | let org: Vec<_> = cert 154 | .subject_name() 155 | .entries_by_nid(openssl::nid::Nid::ORGANIZATIONNAME) 156 | .map(|x| x.data().as_utf8()) 157 | .collect(); 158 | 159 | let mut org_name: Vec = Vec::with_capacity(org.len()); 160 | for o in org { 161 | if let Err(ref e) = o { 162 | println!("While parsing organization name: {}", &e); 163 | } 164 | org_name.push(String::from(AsRef::::as_ref(&o.unwrap()))); 165 | } 166 | org_name 167 | } else { 168 | let mut names = Vec::new(); 169 | // fixme: common names may not be host names. 170 | if let Some(san) = cert.subject_alt_names() { 171 | for name in san.iter() { 172 | if let Some(name) = name.dnsname() { 173 | names.push(String::from(name)); 174 | } else if let Some(uri) = name.uri() { 175 | let url_parsed = reqwest::Url::parse(uri) 176 | .map_err(|_| { 177 | println!("This certificate has a URI SNI, but the URI is not parsable.") 178 | }) 179 | .unwrap(); 180 | if let Some(host) = url_parsed.domain() { 181 | names.push(String::from(host)); 182 | } 183 | } 184 | } 185 | } 186 | names 187 | } 188 | } 189 | 190 | fn main() { 191 | openssl_probe::init_ssl_cert_env_vars(); 192 | 193 | let args = App::new("SSLEnum [SSL Data Enumeration]") 194 | .version("1.0.0") 195 | .author("Mohamed Elbadry ") 196 | .arg( 197 | Arg::with_name("threads") 198 | .short("t") 199 | .long("threads") 200 | .value_name("THREADS") 201 | .help("Sets number of threads") 202 | .takes_value(true) 203 | .default_value("5"), 204 | ) 205 | .arg( 206 | Arg::with_name("domain") 207 | .short("d") 208 | .long("domain") 209 | .value_name("DOMAIN") 210 | .help("Sets domain to check") 211 | .takes_value(true), 212 | ) 213 | .arg( 214 | Arg::with_name("port") 215 | .short("p") 216 | .long("port") 217 | .value_name("PORT") 218 | .help("Sets port number") 219 | .takes_value(true) 220 | .default_value("443"), 221 | ) 222 | .get_matches(); 223 | 224 | if !(args.is_present("domain")) { 225 | let stream = io::stdin(); 226 | let threads_num = value_t!(args.value_of("threads"), usize).unwrap_or(5); 227 | let pool = ThreadPool::new(threads_num); 228 | for domain in stream.lock().lines() { 229 | let tmp = args.value_of("port").unwrap().to_string().clone(); 230 | pool.execute(move || make_connection(domain.unwrap(), tmp)); 231 | } 232 | pool.join(); 233 | } else { 234 | make_connection( 235 | args.value_of("domain").unwrap().to_string(), 236 | args.value_of("port").unwrap().to_string(), 237 | ) 238 | } 239 | } 240 | --------------------------------------------------------------------------------