Skip to content

Commit 2041c62

Browse files
committed
fix: making sure to only use the host target in dns plugin (remove schema, port, etc if specified as url)
1 parent c0b54ea commit 2041c62

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/plugins/dns/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,15 @@ impl Plugin for DNS {
210210
creds: &Credentials,
211211
timeout: Duration,
212212
) -> Result<Option<Vec<Loot>>, Error> {
213-
let subdomain = format!("{}.{}", creds.single(), &creds.target).to_lowercase();
213+
// make sure we only extract the host from the target
214+
let target_host = if let Ok(url) = url::Url::parse(&creds.target) {
215+
url.host_str().unwrap_or(&creds.target).to_string()
216+
} else {
217+
// If not a valid URL, treat as hostname directly
218+
creds.target.clone()
219+
};
220+
221+
let subdomain = format!("{}.{}", creds.single(), &target_host).to_lowercase();
214222
// skip domains that have already been processed
215223
if self.domains.contains(&subdomain) {
216224
return Ok(None);

0 commit comments

Comments
 (0)