Created
January 15, 2018 14:10
-
-
Save ozzi-/554a1bf12b73d35496efe0000ec243e5 to your computer and use it in GitHub Desktop.
crt.sh get subdomains
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param target url such as test.ch | |
* @return set of subdomains that have at one point a https cert | |
*/ | |
public static HashSet<String> runCRTSH(String target){ | |
HashSet<String> subdomainSet = new HashSet<String>(); | |
try { | |
String html = HTTP.get("https://crt.sh/?q=%25."+target); | |
Document doc = Jsoup.parse(html); | |
Elements elements = doc.select("td"); | |
boolean first = true; | |
for (org.jsoup.nodes.Element element : elements) { | |
if(!element.toString().contains("style=") && !first){ | |
subdomainSet.add(element.html()); | |
} | |
first=false; | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return subdomainSet; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment