From 71f3d087ef0bcd10de3316f022f1beee0d74a588 Mon Sep 17 00:00:00 2001 From: bpmcdevitt Date: Sat, 29 May 2021 22:44:10 -0500 Subject: [PATCH] added initial commit --- background.js | 53 +++++++++++++++++++++++++++++++++++++++++++++ icons/logo_48.png | Bin 0 -> 225 bytes icons/mitre_48.png | Bin 0 -> 225 bytes icons/nvd_48.png | Bin 0 -> 225 bytes manifest.json | 21 ++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 background.js create mode 100644 icons/logo_48.png create mode 100644 icons/mitre_48.png create mode 100644 icons/nvd_48.png create mode 100644 manifest.json diff --git a/background.js b/background.js new file mode 100644 index 0000000..76baa80 --- /dev/null +++ b/background.js @@ -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}); +}); diff --git a/icons/logo_48.png b/icons/logo_48.png new file mode 100644 index 0000000000000000000000000000000000000000..90687de26d71e91b7c82565772a7df470ae277a6 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmSQK*5Dp-y;YjHK@;M7UB8wRq zxP?KOkzv*x37}xJr;B4qM&sM7j(iOY0?rpNR{Ym~eNUieh4I>d+mEvHuIy!K@bZ41 zJ}N$e^&*#q7kxbW`Aeg?)>n&l0$ z8xrIlb~3+dVExT-N;ZLA=LS%o!8+lf-GRA$F@Klex9jiV-^0Mj@Zdh*s&d+mEvHuIy!K@bZ41 zJ}N$e^&*#q7kxbW`Aeg?)>n&l0$ z8xrIlb~3+dVExT-N;ZLA=LS%o!8+lf-GRA$F@Klex9jiV-^0Mj@Zdh*s&d+mEvHuIy!K@bZ41 zJ}N$e^&*#q7kxbW`Aeg?)>n&l0$ z8xrIlb~3+dVExT-N;ZLA=LS%o!8+lf-GRA$F@Klex9jiV-^0Mj@Zdh*s&