Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getHighlightsData = (intelCardData) => {
- if (!intelCardData) return {};
- const geo = get(intelCardData, 'info.properties.geo', []);
- const whois = get(intelCardData, 'info.properties.whois', []);
- const dns = get(intelCardData, 'info.properties.dns', []);
- const httpStatus = get(intelCardData, 'info.summary.properties.http.++code', '');
- const contentType = get(intelCardData, 'info.summary.properties.http.++content-type', '');
- const umbrellaRank = get(intelCardData, 'info.umbrella_rank', NaN);
- const redirectTo = get(intelCardData, 'info.redirects.to', []);
- const redirectFrom = get(intelCardData, 'info.redirects.from', []);
- const sslDomains = get(intelCardData, 'info.properties.ssl', []).filter((item) => item.name === 'domain');
- const countryCode = geo.find((item) => item.name === 'countrycode')?.value;
- const region = geo.find((item) => item.name === 'region')?.value;
- const org = geo.find((item) => item.name === 'org')?.value;
- const registrant = whois.find((item) => item.name === '++registrant')?.value;
- const email = whois.find((item) => item.name === '++email')?.value;
- const rName = dns.find((item) => item.name === 'RNAME')?.value;
- const registrar = whois.find((item) => item.name === '++registrar')?.value;
- const technology = get(intelCardData, 'info.attributes.technology', []).join(', ');
- const category = get(intelCardData, 'info.category', '');
- const indicators = get(intelCardData, 'info.summary.risk', {});
- const indicator = get(intelCardData, 'info.indicator', '');
- const title = get(intelCardData, 'info.indicator', '');
- const risk = get(intelCardData, 'info.risk', '');
- const riskFactors = get(intelCardData, 'info.riskfactors', []);
- const typeData = get(intelCardData, 'info.type', 'ip');
- const location = window.location.href;
- let feeds = get(intelCardData, 'info.summary.feeds', []);
- feeds = feeds.map((feed) => feed.name).join(', ');
- return {
- httpStatus,
- indicator,
- contentType,
- umbrellaRank,
- redirectTo,
- redirectFrom,
- sslDomains,
- geo: { countryCode, region, org },
- reg: { registrant, email },
- rName,
- registrar,
- technology,
- type: 'default',
- category,
- indicators,
- feeds,
- title,
- risk,
- riskFactors,
- location,
- typeData,
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement