generated from emo-crab/rust-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f58e3d
commit d028c00
Showing
11 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Mark CVE | ||
--- | ||
[![github]](https://github.com/emo-crab/scap-rs/tree/main/extensions) | ||
|
||
[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github | ||
|
||
- Mark the current page CVE. | ||
|
||
## Using | ||
|
||
- Install the plugin, open a webpage with a CVE number, click on the plugin, and you will see a button added after the CVE. | ||
|
||
![](assets/Screenshot AttackerKB.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// A placeholder for OnSuccess in .then | ||
function onSuccess(message) { | ||
// console.log(`Send OK: ${JSON.stringify(message)}`); | ||
} | ||
|
||
// A placeholder for OnError in .then | ||
function onError(error) { | ||
// console.error(`Promise error: ${error}`); | ||
} | ||
|
||
// A placeholder for OnError in .then | ||
function onErrorWithLog(error) { | ||
console.error(`Promise error: ${error}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wasm-pack build --release --no-typescript --target web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(function () { | ||
function Mark() { | ||
const userSelection = window.getSelection(); | ||
const id = userSelection.toString(); | ||
let cve = userSelection.getRangeAt(0).startContainer.parentNode; | ||
if (cve.getElementsByClassName("Marked").length > 0) { | ||
return | ||
} | ||
const spanElement = document.createElement("span"); | ||
spanElement.setAttribute("class", "Marked"); | ||
const selectedTextRange = userSelection.getRangeAt(0); | ||
selectedTextRange.surroundContents(spanElement); | ||
const icon = document.createElement("a") | ||
icon.href = "https://scap.kali-team.cn/cve/" + id; | ||
icon.target = "_blank" | ||
const svg = document.createElement('img'); | ||
svg.setAttribute("style", "background-color: rgb(154, 205, 50);"); | ||
svg.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpY29uIGljb24tdGFibGVyIGljb24tdGFibGVyLWJ1ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggc3Ryb2tlPSJub25lIiBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTkgOXYtMWEzIDMgMCAwIDEgNiAwdjEiIC8+PHBhdGggZD0iTTggOWg4YTYgNiAwIDAgMSAxIDN2M2E1IDUgMCAwIDEgLTEwIDB2LTNhNiA2IDAgMCAxIDEgLTMiIC8+PHBhdGggZD0iTTMgMTNsNCAwIiAvPjxwYXRoIGQ9Ik0xNyAxM2w0IDAiIC8+PHBhdGggZD0iTTEyIDIwbDAgLTYiIC8+PHBhdGggZD0iTTQgMTlsMy4zNSAtMiIgLz48cGF0aCBkPSJNMjAgMTlsLTMuMzUgLTIiIC8+PHBhdGggZD0iTTQgN2wzLjc1IDIuNCIgLz48cGF0aCBkPSJNMjAgN2wtMy43NSAyLjQiIC8+PC9zdmc+"; | ||
icon.appendChild(svg) | ||
spanElement.appendChild(icon) | ||
} | ||
|
||
function FindCVE() { | ||
const regex = new RegExp('\\bCVE-\\d{4}-\\d{4,7}\\b', 'gmi') | ||
document.designMode = "on"; | ||
const sel = window.getSelection(); | ||
sel.collapse(document.body, 0); | ||
let m; | ||
while (m = regex.exec(document.body.innerText)) { | ||
while (window.find(m)) { | ||
Mark() | ||
} | ||
} | ||
document.designMode = "off"; | ||
} | ||
|
||
FindCVE(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Mark CVE", | ||
"description": "Mark the current page CVE", | ||
"version": "0.1.0", | ||
"homepage_url": "https://github.com/emo-crab/scap-rs/tree/main/extensions", | ||
"author": "Kali-Team", | ||
"action": { | ||
"default_title": "Mark the current page CVE", | ||
"default_icon": { | ||
"19": "assets/emo-crab.png", | ||
"16": "assets/emo-crab.png", | ||
"32": "assets/emo-crab.png", | ||
"38": "assets/emo-crab.png" | ||
} | ||
}, | ||
"icons": { | ||
"19": "assets/emo-crab.png", | ||
"16": "assets/emo-crab.png", | ||
"32": "assets/emo-crab.png", | ||
"38": "assets/emo-crab.png" | ||
}, | ||
"content_security_policy": { | ||
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';" | ||
}, | ||
"background": { | ||
"type": "module", | ||
"scripts": [ | ||
"background.js" | ||
] | ||
}, | ||
"host_permissions": [ | ||
"*://*/*", | ||
"file:///*/*" | ||
], | ||
"permissions": [ | ||
"find", | ||
"activeTab", | ||
"scripting", | ||
"storage" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"run_at": "document_end", | ||
"all_frames": false, | ||
"matches": [ | ||
"*://*/*" | ||
], | ||
"js": [ | ||
"content-script.js" | ||
] | ||
} | ||
], | ||
"web_accessible_resources": [ | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"resources": [ | ||
|
||
] | ||
} | ||
], | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "{59705b32-553e-429d-a9e7-d4d887b419a5}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
html, body { | ||
width: 100px; | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} | ||
|
||
button { | ||
border: none; | ||
width: 100%; | ||
margin: 3% auto; | ||
padding: 4px; | ||
text-align: center; | ||
font-size: 1.5em; | ||
cursor: pointer; | ||
background-color: #E5F2F2; | ||
} | ||
|
||
button:hover { | ||
background-color: #CFF2F2; | ||
} | ||
|
||
button[type="reset"] { | ||
background-color: #FBFBC9; | ||
} | ||
|
||
button[type="reset"]:hover { | ||
background-color: #EAEA9D; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="popup.css"/> | ||
</head> | ||
|
||
<body> | ||
<div id="popup-content"> | ||
<button id="mark">Mark</button> | ||
<button type="reset">Reset</button> | ||
</div> | ||
<div id="error-content" class="hidden"> | ||
<p>Can't mark this web page.</p><p>Try a different page.</p> | ||
</div> | ||
<script src="popup.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
browser.action.onClicked.addListener(async (tab) => { | ||
try { | ||
await browser.scripting.executeScript({ | ||
target: { | ||
tabId: tab.id, | ||
}, | ||
func: () => { | ||
alert("XSS"); | ||
}, | ||
}); | ||
} catch (err) { | ||
console.error(`failed to execute script: ${err}`); | ||
} | ||
}); |