1
!function(e){function t(t){for(var s,o,a=t[0],c=t[1],u=t[2],l=0,p=[];l<a.length;l++)o=a[l],r[o]&&p.push(r[o][0]),r[o]=0;for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(e[s]=c[s]);for(h&&h(t);p.length;)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],s=!0,a=1;a<n.length;a++){var c=n[a];0!==r[c]&&(s=!1)}s&&(i.splice(t--,1),e=o(o.s=n[0]))}return e}var s={},r={3:0},i=[];function o(t){if(s[t])return s[t].exports;var n=s[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=s,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(n,s,function(t){return e[t]}.bind(null,s));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var h=c;i.push([96,0]),n()}({21:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(94),r=n(91),i=n(66);t.Selector=class{constructor(e){this.searchers=[new i.Censys,new i.DomainBigData,new i.FindSubDomains,new i.HybridAnalysis,new i.PublicWWW,new i.Pulsedive,new i.SecurityTrails,new i.Shodan,new i.Urlscan,new i.VirusTotal,new i.XForceExchange],this.scanners=[new r.UrlscanScanner,new r.VirusTotalScanner],this.input=e,this.ioc=s.getIOC(e)}getIP(){return null!==this.ioc.networks.ipv4s?this.ioc.networks.ipv4s[0]:null}getDomain(){return null!==this.ioc.networks.domains?this.ioc.networks.domains[0]:null}getUrl(){return null!==this.ioc.networks.urls?this.ioc.networks.urls[0]:null}getHash(){let e=[];return e=this.concat(e,this.ioc.hashes.sha256s),e=this.concat(e,this.ioc.hashes.sha1s),0===(e=this.concat(e,this.ioc.hashes.md5s)).length?null:e[0]}getSearchersByType(e){return this.searchers.filter(t=>-1!==t.supportedTypes.indexOf(e))}getScannersByType(e){return this.scanners.filter(t=>-1!==t.supportedTypes.indexOf(e))}getSearcherEntries(){let e=[];e=this.concat(e,this.makeAnalyzerEntries(this.getSearchersByType("text"),"text",this.input));const t=this.getUrl();if(null!==t)return this.concat(e,this.makeAnalyzerEntries(this.getSearchersByType("url"),"url",t));const n=this.getDomain();if(null!==n)return this.concat(e,this.makeAnalyzerEntries(this.getSearchersByType("domain"),"domain",n));const s=this.getIP();if(null!==s)return this.concat(e,this.makeAnalyzerEntries(this.getSearchersByType("ip"),"ip",s));const r=this.getHash();return null!==r?this.concat(e,this.makeAnalyzerEntries(this.getSearchersByType("hash"),"hash",r)):e}getScannerEntries(){const e=this.getUrl();if(null!==e)return this.makeAnalyzerEntries(this.getScannersByType("url"),"url",e);const t=this.getDomain();if(null!==t)return this.makeAnalyzerEntries(this.getScannersByType("domain"),"domain",t);const n=this.getIP();return null!==n?this.makeAnalyzerEntries(this.getScannersByType("ip"),"ip",n):[]}concat(e,t){return null!==t?e.concat(t):e}makeAnalyzerEntries(e,t,n){const s=[];for(const r of e)s.push(this.makeAnalyzerEntry(r,t,n));return s}makeAnalyzerEntry(e,t,n){return{analyzer:e,type:t,query:n}}}},24:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.XForceExchange=class{constructor(){this.supportedTypes=["ip","domain","hash"],this.endpoint="https://exchange.xforce.ibmcloud.com",this.name="X-Force-Exchange"}searchByIP(e){return`${this.endpoint}/ip/${e}`}searchByDomain(e){return`${this.endpoint}/url/${e}`}searchByHash(e){return`${this.endpoint}/malware/${e}`}}},33:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(12),r=n(32);t.VirusTotal=class{constructor(){this.supportedTypes=["ip","domain","url","hash"],this.endpoint="https://www.virustotal.com/#",this.name="VirusTotal"}searchByIP(e){return`${this.endpoint}/ip-address/${e}`}searchByURL(e){const t=s.SHA256(this.normalizeUrl(e));return`${this.endpoint}/url/${t}`}normalizeUrl(e){return"/"===r.parse(e).pathname&&"/"!==e.slice(-1)?`${e}/`:e}searchByDomain(e){return`${this.endpoint}/domain/${e}`}searchByHash(e){return`${this.endpoint}/file/${e}`}}},34:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Urlscan=class{constructor(){this.supportedTypes=["ip","domain","url"],this.endpoint="https://urlscan.io/api/v1",this.name="Urlscan"}searchByIP(e){const t=encodeURIComponent(e);return this.search(t)}searchByDomain(e){const t=encodeURIComponent(e);return this.search(t)}searchByURL(e){const t=encodeURIComponent(`"${e}"`);return this.search(t)}search(e){return`https://urlscan.io/search/#${e}`}}},35:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Shodan=class{constructor(){this.supportedTypes=["text"],this.endpoint="https://www.shodan.io",this.name="Shodan"}searchByText(e){const t=encodeURIComponent(e);return`${this.endpoint}/search?query=${t}`}}},36:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SecurityTrails=class{constructor(){this.supportedTypes=["domain","ip"],this.endpoint="https://securitytrails.com",this.name="SecurityTrails"}searchByText(e){const t=encodeURIComponent(e);return`${this.endpoint}/list/keyword/${t}`}searchByIP(e){return`${this.endpoint}/list/ip/${e}`}searchByDomain(e){return`${this.endpoint}/domain/${e}`}}},60:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(12);t.Pulsedive=class{constructor(){this.supportedTypes=["ip","domain","url","hash"],this.endpoint="https://pulsedive.com",this.name="Pulsedive"}searchByIP(e){return this.search(e)}searchByDomain(e){return this.search(e)}searchByURL(e){return this.search(e)}searchByHash(e){return this.search(e)}search(e){const t=s.enc.Utf8.parse(e),n=s.enc.Base64.stringify(t);return`${this.endpoint}/indicator/?ioc=${n}`}}},61:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PublicWWW=class{constructor(){this.supportedTypes=["text"],this.endpoint="https://publicwww.com/websites",this.name="PublicWWW"}searchByText(e){const t=encodeURIComponent(e);return`${this.endpoint}/${t}`}}},62:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.HybridAnalysis=class{constructor(){this.supportedTypes=["hash"],this.endpoint="https://www.hybrid-analysis.com",this.name="HybridAnalysis"}searchByHash(e){if(64!==e.length)throw new Error("HybridAnalysis onlys suports SHA256");return`${this.endpoint}/sample/${e}`}}},63:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FindSubDomains=class{constructor(){this.supportedTypes=["domain"],this.endpoint="https://findsubdomains.com",this.name="FindSubDomains"}searchByDomain(e){return`${this.endpoint}/subdomains-of/${e}`}}},64:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.DomainBigData=class{constructor(){this.supportedTypes=["domain"],this.endpoint="https://domainbigdata.com",this.name="DomainBigData"}searchByDomain(e){return`${this.endpoint}/${e}`}}},65:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Censys=class{constructor(){this.supportedTypes=["text"],this.endpoint="https://censys.io",this.name="Censys"}searchByText(e){const t=encodeURIComponent(e);return`${this.endpoint}/ipv4?q=${t}`}}},66:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(65);t.Censys=s.Censys;var r=n(64);t.DomainBigData=r.DomainBigData;var i=n(63);t.FindSubDomains=i.FindSubDomains;var o=n(62);t.HybridAnalysis=o.HybridAnalysis;var a=n(61);t.PublicWWW=a.PublicWWW;var c=n(60);t.Pulsedive=c.Pulsedive;var u=n(36);t.SecurityTrails=u.SecurityTrails;var h=n(35);t.Shodan=h.Shodan;var l=n(34);t.Urlscan=l.Urlscan;var p=n(33);t.VirusTotal=p.VirusTotal;var y=n(24);t.XForceExchange=y.XForceExchange},70:function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(20),i=n(69);t.VirusTotalScanner=class{constructor(){this.supportedTypes=["url"],this.endpoint="https://www.virustotal.com/vtapi/v2",this.name="VirusTotal"}setApiKey(e){this.apiKey=e}scanByURL(e){return s(this,void 0,void 0,function*(){if(void 0===this.apiKey)throw Error("Please set your VirusTotal API key via the option.");const t={apikey:this.apiKey,url:e};return(yield r.default.post(`${this.endpoint}/url/scan`,i.stringify(t))).data.permalink})}}},90:function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(20);t.UrlscanScanner=class{constructor(){this.supportedTypes=["ip","domain","url"],this.endpoint="https://urlscan.io/api/v1",this.name="Urlscan"}setApiKey(e){this.apiKey=e}scanByIP(e){return s(this,void 0,void 0,function*(){return yield this.scan(e)})}scanByDomain(e){return s(this,void 0,void 0,function*(){return yield this.scan(e)})}scanByURL(e){return s(this,void 0,void 0,function*(){return yield this.scan(e)})}scan(e,t=!0){return s(this,void 0,void 0,function*(){if(void 0===this.apiKey)throw Error("Please set your urlscan.io API key via the option.");return(yield r.default.post(`${this.endpoint}/scan/`,{public:t?"on":"off",url:e},{headers:{"API-KEY":this.apiKey}})).data.result})}}},91:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n(90);t.UrlscanScanner=s.UrlscanScanner;var r=n(70);t.VirusTotalScanner=r.VirusTotalScanner},95:function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(21);t.Command=class{constructor(e){this.parts=e.split(" "),this.action=this.parts[0].toLowerCase(),this.query=this.parts.slice(1,this.parts.length-5).join(" "),this.target=this.parts[this.parts.length-1]}search(){const e=new r.Selector(this.query).getSearcherEntries().find(e=>e.analyzer.name===this.target);let t="";if(void 0!==e){const n=e.analyzer;switch(e.type){case"text":t=n.searchByText(e.query);break;case"ip":t=n.searchByIP(e.query);break;case"domain":t=n.searchByDomain(e.query);break;case"url":t=n.searchByURL(e.query);break;case"hash":t=n.searchByHash(e.query)}}return t}scan(e){return s(this,void 0,void 0,function*(){const t=new r.Selector(this.query).getScannerEntries().find(e=>e.analyzer.name===this.target);let n="";if(void 0!==t){const s=t.analyzer;switch(s.name){case"Urlscan":s.setApiKey(e.urlscanApiKey);break;case"VirusTotal":s.setApiKey(e.virusTotalApiKey)}switch(t.type){case"ip":n=yield s.scanByIP(t.query);break;case"domain":n=yield s.scanByDomain(t.query);break;case"url":n=yield s.scanByURL(t.query)}}return n})}}},96:function(e,t,n){"use strict";var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(o,a)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=n(95),i=n(21);function o(e){chrome.notifications.create({iconUrl:"./icons/48.png",message:e,title:"Mitaka",type:"basic"})}chrome.contextMenus.onClicked.addListener((e,t)=>{const n=e.menuItemId,i=new r.Command(n);switch(i.action){case"search":!function(e){try{const t=e.search();void 0!==t&&""!==t&&chrome.tabs.create({url:t})}catch(e){o(e.message)}}(i);break;case"scan":!function(e){chrome.storage.sync.get("apiKeys",t=>s(this,void 0,void 0,function*(){const n={urlscanApiKey:t.apiKeys.urlscanApiKey,virusTotalApiKey:t.apiKeys.virusTotalApiKey};try{const t=yield e.scan(n);void 0!==t&&""!==t&&chrome.tabs.create({url:t})}catch(e){o(e.message)}}))}(i)}}),chrome.runtime.onMessage.addListener((e,t,n)=>{"removeContextMenu"===e.request&&chrome.contextMenus.removeAll(),"updateContextMenu"===e.request&&chrome.contextMenus.removeAll(()=>{const t=e.selection,n=new i.Selector(t),s=n.getSearcherEntries();for(const e of s){const t=e.analyzer.name,n={contexts:["selection"],id:`Search ${e.query} as a ${e.type} on ${t}`,title:`Search this ${e.type} on ${t}`};chrome.contextMenus.create(n)}const r=n.getScannerEntries();for(const e of r){const t=e.analyzer.name,n={contexts:["selection"],id:`Scan ${e.query} as a ${e.type} on ${t}`,title:`Scan this ${e.type} on ${t}`};chrome.contextMenus.create(n)}})})}});