MCPcopy Create free account
hub / github.com/adobe/Marinus / censysResult

Function censysResult

web_server/public/javascripts/api.js:546–615  ·  view source on GitHub ↗
(results)

Source from the content-addressed store, hash-verified

544}
545
546function censysResult(results) {
547 var portList = {
548 'p21': 'ftp',
549 'p22': 'ssh',
550 'p23': 'telnet',
551 'p25': 'smtp',
552 'p53': 'dns',
553 'p80': 'http',
554 'p110': 'pop3',
555 'p143': 'imap',
556 'p443': 'https',
557 'p465': 'smtps',
558 'p502': 'modbus',
559 'p8080': 'http',
560 'p993': 'imaps',
561 'p995': 'pop3s',
562 'p47808': 'bacnet',
563 'p7547': 'cwmp'
564 };
565 var staticList = ["location", "ip", "autonomous_system", "createdAt", "tags", "zones", "domains", "ipint", "aws", "azure", "ports"];
566 if (results.length === 0) {
567 return;
568 }
569
570 var htmlOut = "";
571 var censysTag = document.getElementById("censysInformation");
572 document.getElementById("censysInformation").style.display = "block";
573
574 htmlOut += '\
575 <div class="table">\
576 <div class="tableRow">\
577 <div class="tableCell">';
578 htmlOut += create_new_list();
579
580 for (var i = 0; i < results.length; i++) {
581
582 if (!(Object.hasOwn(results[i], "tags")) || results[i]["tags"].length === 0) {
583 for (let val in results[i]) {
584 if (val !== "_id") {
585 htmlOut += create_list_entry(val + ':' + i.toString(), val, "#");
586 }
587 }
588 } else {
589 for (let val in results[i]) {
590 if (staticList.indexOf(val) != -1) {
591 htmlOut += create_list_entry(val + ':' + i.toString(), val, "#");
592 } else if ((val.startsWith("p")) && val !== "ports" && (results[i]["tags"].indexOf(portList[val]) !== -1)) {
593 htmlOut += create_list_entry(val + ':' + i.toString(), '<img src="/stylesheets/octicons/svg/file-24.svg" alt="data"></img>&nbsp;' + val + ' (' + portList[val] + ')', "#");
594 } else if (val.startsWith("p") && val !== "ports") {
595 htmlOut += create_list_entry(val + ':' + i.toString(), val + ' (' + portList[val] + ')', "#");
596 }
597 }
598 }
599 }
600 htmlOut += end_list();
601 htmlOut += '</div>';
602 htmlOut += '<div class="tableCell bg-light" id="censysOutput"></div>';
603 htmlOut += '</div></div><br/>';

Callers

nothing calls this directly

Calls 3

create_new_listFunction · 0.85
create_list_entryFunction · 0.85
end_listFunction · 0.85

Tested by

no test coverage detected