Skip to content

Instantly share code, notes, and snippets.

@b1tninja
Created March 7, 2019 06:48
Show Gist options
  • Save b1tninja/a2013fe74c063d469e67faac973c5eb1 to your computer and use it in GitHub Desktop.
Save b1tninja/a2013fe74c063d469e67faac973c5eb1 to your computer and use it in GitHub Desktop.
fetch('https://www.archlinux.org/master-keys/').then(resp=>{
resp.text().then(html=>{
parser = new DOMParser();
doc = parser.parseFromString(html, "text/html");
xpath_result = doc.evaluate('//tr[th/text()]//a[contains(@href, "https://sks-keyservers.net/pks/lookup?op=vindex&fingerprint=on&exact=on&search=")]', doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE)
for (i = 0; i < xpath_result.snapshotLength; i++) {
a = xpath_result.snapshotItem(i);
fingerprint = (new URL(a.href,window.location)).searchParams.get('search');
developer = doc.evaluate('ancestor::tr/th/text()', a, null, XPathResult.STRING_TYPE).stringValue;
console.log(`${fingerprint} ${developer}`);
}
}
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment