From fc52b805ad75462ed146f1cbd085ccaa03706be4 Mon Sep 17 00:00:00 2001 From: pwnwriter Date: Thu, 2 Nov 2023 20:55:13 +0545 Subject: [PATCH] chore(shoot): [closes #22] ignore danger certs // dns --- Cargo.lock | 136 ++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 8 +-- src/cli/screenshot.rs | 14 +++-- 3 files changed, 150 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 076e289..fb34970 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,6 +80,17 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-tungstenite" version = "0.23.0" @@ -375,6 +386,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "errno" version = "0.3.2" @@ -570,6 +593,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.9" @@ -677,6 +711,18 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.3", + "widestring", + "windows-sys", + "winreg 0.50.0", +] + [[package]] name = "ipnet" version = "2.8.0" @@ -721,6 +767,12 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.5" @@ -743,6 +795,21 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "memchr" version = "2.5.0" @@ -856,6 +923,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.33" @@ -965,6 +1038,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", + "trust-dns-resolver", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -973,6 +1047,16 @@ dependencies = [ "winreg 0.50.0", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -1329,6 +1413,52 @@ dependencies = [ "once_cell", ] +[[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", + "ipnet", + "once_cell", + "rand", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.4" @@ -1524,6 +1654,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index c4829fb..d7b5174 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,15 +14,15 @@ categories = ["accessibility", "web-programming", "command-line" ] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -url = "2.4.1" -reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls"] } -tokio = { version = "1.33.0", features = ["full"] } chromiumoxide = { version = "0.5.4", features = ["tokio-runtime"], default-features = false } -futures = "0.3.28" +reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "trust-dns"] } clap = { version = "4.4.6", features = ["derive", "string"] } +tokio = { version = "1.33.0", features = ["full"] } +futures = "0.3.28" columns = "0.1.0" colored = "2.0.4" anyhow = "1.0.75" +url = "2.4.1" [profile.dev] opt-level = 0 diff --git a/src/cli/screenshot.rs b/src/cli/screenshot.rs index 5b410ed..a9cfb54 100644 --- a/src/cli/screenshot.rs +++ b/src/cli/screenshot.rs @@ -137,9 +137,15 @@ async fn take_screenshot( silent: bool, ) -> anyhow::Result<()> { let parsed_url = Url::parse(&url)?; - let res = time::timeout( + let client = reqwest::Client::builder() + .danger_accept_invalid_certs(true) + .http1_ignore_invalid_headers_in_responses(true) + .trust_dns(true) + .build()?; + + let response = time::timeout( Duration::from_secs(timeout), - reqwest::get(parsed_url.clone()), + client.get(parsed_url.clone()).send(), ) .await .context(format!("[-] Timed out URL = {url}"))??; @@ -156,10 +162,10 @@ async fn take_screenshot( if !silent { match page.get_title().await { - Ok(Some(title)) => show_info(url.clone(), title, res.status()), + Ok(Some(title)) => show_info(url.clone(), title, response.status()), _ => { let title = "No title".to_string(); - show_info(url.clone(), title, res.status()); + show_info(url.clone(), title, response.status()); } } }