Soty89

highligth

Oct 26th, 2021
753
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getHighlightsData = (intelCardData) => {
  2.   if (!intelCardData) return {};
  3.  
  4.   const geo = get(intelCardData, 'info.properties.geo', []);
  5.   const whois = get(intelCardData, 'info.properties.whois', []);
  6.   const dns = get(intelCardData, 'info.properties.dns', []);
  7.   const httpStatus = get(intelCardData, 'info.summary.properties.http.++code', '');
  8.   const contentType = get(intelCardData, 'info.summary.properties.http.++content-type', '');
  9.   const umbrellaRank = get(intelCardData, 'info.umbrella_rank', NaN);
  10.   const redirectTo = get(intelCardData, 'info.redirects.to', []);
  11.   const redirectFrom = get(intelCardData, 'info.redirects.from', []);
  12.   const sslDomains = get(intelCardData, 'info.properties.ssl', []).filter((item) => item.name === 'domain');
  13.   const countryCode = geo.find((item) => item.name === 'countrycode')?.value;
  14.   const region = geo.find((item) => item.name === 'region')?.value;
  15.   const org = geo.find((item) => item.name === 'org')?.value;
  16.   const registrant = whois.find((item) => item.name === '++registrant')?.value;
  17.   const email = whois.find((item) => item.name === '++email')?.value;
  18.   const rName = dns.find((item) => item.name === 'RNAME')?.value;
  19.   const registrar = whois.find((item) => item.name === '++registrar')?.value;
  20.   const technology = get(intelCardData, 'info.attributes.technology', []).join(', ');
  21.   const category = get(intelCardData, 'info.category', '');
  22.   const indicators = get(intelCardData, 'info.summary.risk', {});
  23.   const indicator = get(intelCardData, 'info.indicator', '');
  24.   const title = get(intelCardData, 'info.indicator', '');
  25.   const risk = get(intelCardData, 'info.risk', '');
  26.   const riskFactors = get(intelCardData, 'info.riskfactors', []);
  27.   const typeData = get(intelCardData, 'info.type', 'ip');
  28.   const location = window.location.href;
  29.   let feeds = get(intelCardData, 'info.summary.feeds', []);
  30.   feeds = feeds.map((feed) => feed.name).join(', ');
  31.   return {
  32.     httpStatus,
  33.     indicator,
  34.     contentType,
  35.     umbrellaRank,
  36.     redirectTo,
  37.     redirectFrom,
  38.     sslDomains,
  39.     geo: { countryCode, region, org },
  40.     reg: { registrant, email },
  41.     rName,
  42.     registrar,
  43.     technology,
  44.     type: 'default',
  45.     category,
  46.     indicators,
  47.     feeds,
  48.     title,
  49.     risk,
  50.     riskFactors,
  51.     location,
  52.     typeData,
  53.   };
  54. };
  55.  
RAW Paste Data