Mozilla Monitor arms you with tools to keep your personal information safe. Find out what hackers already know about you and learn how to stay a step ahead of them.
import axios from "axios";
const DOMAIN = "https://stage.firefoxmonitor.nonprod.cloudops.mozgcp.net";
// This URL endpoint didn't exist on stage, so I had to hardcode to production (but will break when we promote stage=>prod unless I swap over to upstream HIBP breaches domain.
const BREACH_URL = new URL("/hibp/breaches", "https://monitor.firefox.com").href;
const LOGO_PREFIX = new URL("/images/logo_cache/", DOMAIN).href;
let missingLogos = [];
const breaches = await getBreaches();
const domainBreaches = breaches.filter(breach => breach.Domain !== "");
console.log(domainBreaches.length, "of", breaches.length, "have a Domain");
for (const breach of domainBreaches) {
await fetchLogo(breach.Domain);
}
console.error("missing:", missingLogos.length);
missingLogos
.forEach(e => console.error(e.logoUrl));
async function fetchLogo(domain) {
const logoUrl = new URL(`${domain}.ico`, LOGO_PREFIX);
try {
const res = await axios.get(logoUrl);
if (res.data.includes("We’re sorry, the page you’re looking for no longer exists.")) {
const e = new Error(`Unable to find logo for ${domain}`);
e.domain = domain;
e.logoUrl = logoUrl.href;
throw e;
}
} catch (err) {
missingLogos.push(err);
process.exitCode = 1;
}
}
async function getBreaches() {
const res = await axios.get(BREACH_URL);
return res.data;
}
One interesting result is I get a 404 for kickstarter.com logo, but I do get a logo if I query DDG directly: https://icons.duckduckgo.com/ip3/kickstarter.com.ico
I didn't try querying the entire list of 196 missing logos to see how many are in DDG (although all the others I've spot checked were not in DDG).
UPDATE: Cleaned this up a bit and pushed to GitHub: https://github.com/pdehaan/blurts-logo-lint
Behold, a logo linter.
OUTPUT
One interesting result is I get a 404 for kickstarter.com logo, but I do get a logo if I query DDG directly: https://icons.duckduckgo.com/ip3/kickstarter.com.ico I didn't try querying the entire list of 196 missing logos to see how many are in DDG (although all the others I've spot checked were not in DDG).