├── images ├── icon16.png ├── icon48.png ├── logo.png └── icon128.png ├── fonts ├── glyphicons-halflings-regular.eot ├── glyphicons-halflings-regular.ttf ├── glyphicons-halflings-regular.woff └── glyphicons-halflings-regular.woff2 ├── README.md ├── manifest.json ├── js ├── settings.js ├── content.js ├── background.js ├── jquery.jsonPresenter.js ├── popper.min.js ├── bootstrap.min.js ├── bootstrap3.3.7.min.js └── popup.js ├── css ├── jquery.jsonPresenter.css └── custom.css ├── settings.html ├── index.html └── LICENSE /images/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/images/icon16.png -------------------------------------------------------------------------------- /images/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/images/icon48.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/images/logo.png -------------------------------------------------------------------------------- /images/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/images/icon128.png -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fireeye/detection-on-demand-chrome-plugin-demo/master/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FireEye Detection On Demand Chrome Extension 2 | This Chrome extension is an example of how to use FireEye's Detection On Demand service. 3 | 4 | ## Installation 5 | * Clone this repo using `git clone https://github.com/fireeye/detection-on-demand-chrome-plugin-demo.git` 6 | * Visit `chrome://extensions` (via omnibox or Menu -> Tools -> Extensions). 7 | * Enable Developer mode by ticking the checkbox in the upper-right corner. 8 | * Click on the "Load unpacked extension..." button. 9 | * Select the directory containing your unpacked extension. 10 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FireEye - Detection On Demand", 3 | "description": "Allows users to submit files to FireEye cloud for analysis and show analysis results", 4 | "version": "2.1.2", 5 | 6 | "manifest_version": 2, 7 | "browser_action": { 8 | "default_icon": "images/logo.png", 9 | "default_popup": "index.html", 10 | "default_title": "FireEye - Detection On Demand" 11 | }, 12 | "icons" : { 13 | "16": "images/icon16.png", 14 | "48": "images/icon48.png", 15 | "128": "images/icon128.png" 16 | }, 17 | "background": { 18 | "scripts": ["js/background.js"] 19 | }, 20 | "permissions": [ 21 | "downloads", 22 | "https://feapi.marketplace.apps.fireeye.com/*", 23 | "activeTab", 24 | "storage", 25 | "clipboardRead" 26 | ], 27 | "web_accessible_resources": [ 28 | "fonts/FontAwesome.otf", 29 | "fonts/fontawesome-webfont.eot", 30 | "fonts/fontawesome-webfont.svg", 31 | "fonts/fontawesome-webfont.ttf", 32 | "fonts/fontawesome-webfont.woff", 33 | "fonts/fontawesome-webfont.woff2" 34 | ] 35 | } -------------------------------------------------------------------------------- /js/settings.js: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2019 FireEye, Inc. All Rights Reserved.*/ 2 | document.getElementById('save_email').addEventListener('click', save_options); 3 | restore_options(); 4 | function restore_options() 5 | { 6 | console.log("Restoring old values"); 7 | /* chrome.storage.local.get("user_email",function(items) { 8 | if (items.user_email != undefined) 9 | document.getElementById("email_text").value = items.user_email; 10 | }); */ 11 | chrome.storage.local.get("api_key",function(items) { 12 | if (items.api_key != undefined) 13 | document.getElementById("api_key").value = items.api_key; 14 | }); 15 | } 16 | 17 | function save_options() 18 | { 19 | var api_key = document.getElementById("api_key").value.trim(); 20 | 21 | var promises = []; 22 | promises[0] = new Promise(function (resolve, reject){ 23 | chrome.storage.local.set({"api_key" : api_key}, resolve); 24 | 25 | }); 26 | 27 | Promise.all(promises).then(function(values){ 28 | console.log("Values set") 29 | $("#msg").html("API key saved successfully"); 30 | $("#msg").addClass("alert alert-success"); 31 | }); 32 | } -------------------------------------------------------------------------------- /css/jquery.jsonPresenter.css: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery Json Presenter Plugin v1.0.0 3 | * 4 | * Copyright 2014 Steven Pease 5 | * Released under the MIT license: 6 | * http://www.opensource.org/licenses/mit-license.php 7 | */ 8 | .parsed-json { 9 | font-size: 11px !important; 10 | font-family: Menlo, monospace; 11 | margin-top: 0px; 12 | margin-bottom: 0px; 13 | } 14 | 15 | .parsed-json-expandable-ellipsis:hover, 16 | .parsed-json-property-expandable:hover, 17 | .parsed-json-property-toggleable:hover, 18 | .parsed-json-has-alternate-value:hover { 19 | cursor: hand; 20 | cursor: pointer; 21 | } 22 | 23 | .parsed-json-property-name { 24 | color: rgb(136, 19, 145); 25 | } 26 | 27 | .parsed-json-object-comma { 28 | color: #333; 29 | } 30 | 31 | .parsed-json-value-boolean { 32 | color: #0000ff; 33 | } 34 | 35 | .parsed-json-value-function, 36 | .parsed-json-array-bracket, 37 | .parsed-json-object-bracket { 38 | color: #333; 39 | } 40 | 41 | .parsed-json-value-null, 42 | .parsed-json-value-undefined { 43 | color: rgb(128, 128, 128); 44 | } 45 | 46 | .parsed-json-value-number { 47 | color: #5FB526; 48 | } 49 | 50 | .parsed-json-value-regexp, 51 | .parsed-json-value-string { 52 | color: rgb(196, 26, 22); 53 | white-space: pre; 54 | unicode-bidi: -webkit-isolate; 55 | } 56 | 57 | .parsed-json .hidden { 58 | display: none; 59 | } 60 | -------------------------------------------------------------------------------- /js/content.js: -------------------------------------------------------------------------------- 1 | /*Copyright (C) 2019 FireEye, Inc. All Rights Reserved.*/ 2 | if (window.hasRun == undefined) { 3 | function get_hashes() { 4 | wholepage = document.body.innerText; 5 | var links = document.links; 6 | var sha1_ex = /\b[a-fA-F0-9]{32}\b/gi; 7 | var hash_regex = new RegExp(sha1_ex); 8 | 9 | var result; 10 | var hashes = []; 11 | do { 12 | result = hash_regex.exec(wholepage); 13 | if (result && hashes.indexOf(result[0]) == -1) { 14 | var temp = result[0].toLowerCase(); 15 | if (hashes.indexOf(temp) == -1) { 16 | hashes.push(temp); 17 | } 18 | } 19 | } while (result); 20 | if (hashes.length >= 1) { 21 | var msg = { 22 | action: 1, 23 | hash: hashes, 24 | } 25 | return msg; 26 | } 27 | } 28 | function gotMsg(request, sender, sendResponse) { 29 | if (request.msg === "start") { 30 | var msg = get_hashes(); 31 | if (msg) { 32 | console.log(msg); 33 | sendResponse(msg); 34 | } else 35 | sendResponse("NA"); 36 | } 37 | } 38 | chrome.runtime.onMessage.addListener(gotMsg); 39 | window.hasRun = true; 40 | } -------------------------------------------------------------------------------- /settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
21 |
27 | ' + processJsonValue( settings, settings.json ) + '' ); 301 | } 302 | 303 | /** 304 | * @param {DOMNode} containerElement The container element to check whether it already has JSON being presented within it 305 | * @return {Boolean} Whether the provided container element already has JSON being presented within it 306 | */ 307 | function isAlreadyPresentingJson( containerElement ) { 308 | return !!containerElement.find( '> pre.parsed-json' ).length; 309 | } 310 | 311 | $.fn.jsonPresenter = function( options ) { 312 | if ( options && typeof options === 'object' ) { 313 | var defaults = { 314 | json: {}, 315 | wrapPropertiesInQuotes: false 316 | }; 317 | 318 | var settings = $.extend( {}, defaults, options ); 319 | 320 | return this.each( function() { 321 | create( $( this ), settings ); 322 | 323 | if ( typeof settings.expand !== 'undefined' ) { 324 | $( this ).jsonPresenter( 'expand', settings.expand ); 325 | } 326 | } ); 327 | } else if ( arguments[ 0 ] === 'destroy' ) { 328 | return this.each( function() { 329 | destroy( $( this ) ); 330 | } ); 331 | } else if ( arguments[ 0 ] === 'expandAll' ) { 332 | return this.each( function() { 333 | expandAll( getRootNode( $( this ) ) ); 334 | } ); 335 | } else if ( arguments[ 0 ] === 'collapseAll' ) { 336 | return this.each( function() { 337 | collapseAll( getRootNode( $( this ) ) ); 338 | } ); 339 | } else if ( arguments[ 0 ] === 'expand' ) { 340 | var depth = arguments[ 1 ]; 341 | return this.each( function() { 342 | collapseAll( getRootNode( $( this ) ) ); 343 | expand( getRootNode( $( this ) ), depth ); 344 | } ); 345 | } 346 | }; 347 | } )( jQuery ); 348 | -------------------------------------------------------------------------------- /js/popper.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) Federico Zivolo 2018 3 | Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). 4 | */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){return 11===e?re:10===e?pe:re||pe}function p(e){if(!e)return document.documentElement;for(var o=r(10)?document.body:null,n=e.offsetParent;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function d(e){return null===e.parentNode?e:d(e.parentNode)}function a(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,r=document.createRange();r.setStart(n,0),r.setEnd(i,0);var l=r.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return s(l)?l:p(l);var f=d(e);return f.host?a(f.host,t):a(e,d(t).host)}function l(e){var t=1