added initial commit

This commit is contained in:
Brendan McDevitt 2021-05-29 22:44:10 -05:00
commit 71f3d087ef
5 changed files with 74 additions and 0 deletions

53
background.js Normal file
View file

@ -0,0 +1,53 @@
// adapted from heavily from:
// https://medium.com/bugbountywriteup/sputnik-an-open-source-intelligence-browser-extension-da2f2c22c8ec
// https://github.com/mitchmoser/sputnik
browser.contextMenus.create({
id: "CVE Search",
title: "CVE Search",
contexts: ["selection"]
});
browser.contextMenus.create({
id: "NVD",
title: "NVD",
contexts: ["selection"],
parentId: "CVE Search",
icons: {
"48": "icons/nvd_48.png"
}
});
browser.contextMenus.create({
id: "MITRE",
title: "MITRE",
contexts: ["selection"],
parentId: "CVE Search",
icons: {
"48": "icons/mitre_48.png"
}
});
// create empty url variable
var url = ""
/*
* The click event listener:
* where we perform the approprate action
* given the ID of the menu item that was clicked
*/
browser.contextMenus.onClicked.addListener((info, tab) => {
// copy the selection to clipboard
navigator.clipboard.writeText(info.selectionText);
switch (info.menuItemId) {
case "NVD":
url = "https://nvd.nist.gov/vuln/detail/"+info.selectionText;
break;
case "MITRE":
url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name="+info.selectionText;
break;
}
browser.tabs.create({url: url});
});

BIN
icons/logo_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

BIN
icons/mitre_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

BIN
icons/nvd_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

21
manifest.json Normal file
View file

@ -0,0 +1,21 @@
{
"manifest_version": 2,
"name": "CVE Searcher",
"version": "1.0",
"description": "Search a piece of highlighted text in either nvd.nist.gov or cve.mitre.org",
"icons": {
"48": "icons/logo_48.png"
},
"permissions": [
"clipboardWrite",
"contextMenus",
"menus"
],
"background": {
"scripts": ["background.js"]
}
}