Skip to content

Instantly share code, notes, and snippets.

@ozzi-
Created January 15, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozzi-/554a1bf12b73d35496efe0000ec243e5 to your computer and use it in GitHub Desktop.
Save ozzi-/554a1bf12b73d35496efe0000ec243e5 to your computer and use it in GitHub Desktop.
crt.sh get subdomains
/**
* @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