Skip to content

Commit

Permalink
Update dangling detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Elbadry committed Sep 10, 2021
1 parent cfd4138 commit a28925e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sslenum"
version = "1.0.0"
version = "1.0.1"
authors = ["melbadry9 <me@melbadry9.xyz>"]
edition = "2018"
description = "SSL certificate Extractor"
Expand Down
38 changes: 25 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,37 @@ struct DomainData {
impl DomainData {
fn check_dangling(self: &mut Self) {
let domain = List.parse_dns_name(self.hostname.as_str()).unwrap();
let host = List.parse_dns_name(self.cn[0].as_str());
match host {
Ok(host) => {
let host_root = host.root();
match host_root {
Some(host_root) => {
if !(domain.root().unwrap() == host_root) {
let mut dns_names: Vec<String> = Vec::new();

dns_names.extend(self.cn.clone());
dns_names.extend(self.alt_names.clone());

for cand in dns_names {
let host = List.parse_dns_name(cand.as_str());
match host {
Ok(host) => {
let host_root = host.root();
match host_root {
Some(host_root) => {
if !(domain.root().unwrap() == host_root) {
self.dangling = true;
} else {
self.dangling = false;
break;
}
}
None => {
self.dangling = true;
}
}
None => {
self.dangling = true;
}
}
Err(_) => {
self.dangling = false;
}
}
Err(_) => {
self.dangling = false;
}

}

}
}

Expand Down

0 comments on commit a28925e

Please sign in to comment.