added initial commit
This commit is contained in:
commit
71f3d087ef
5 changed files with 74 additions and 0 deletions
53
background.js
Normal file
53
background.js
Normal 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
BIN
icons/logo_48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
BIN
icons/mitre_48.png
Normal file
BIN
icons/mitre_48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
BIN
icons/nvd_48.png
Normal file
BIN
icons/nvd_48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
21
manifest.json
Normal file
21
manifest.json
Normal 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"]
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue