Shortcut for easier XSS filter testing.

This commit is contained in:
hackademix 2021-01-15 17:23:32 +01:00
parent 5f343ad16a
commit 17f3bfd14b
2 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,5 @@
if (UA.isMozilla) {
let y = async (url, originUrl = '') => await XSS.maybe(XSS.parseRequest({originUrl, url, method: "GET"}));
let y = async (url, originUrl = '') => await XSS.test({originUrl, url, method: "GET"});
let n = async (...args) => !await y(...args);
Promise.all([
() => y("https://noscript.net/<script"),

View File

@ -7,6 +7,8 @@ var XSS = (() => {
let workersMap = new Map();
let promptsMap = new Map();
let requestIdCount = 0;
async function getUserResponse(xssReq) {
let {originKey} = xssReq;
await promptsMap.get(originKey);
@ -309,6 +311,20 @@ var XSS = (() => {
return false;
};
});
},
async test(urlOrRequest) {
let r = {
requestId: `fake${requestIdCount++}`,
originUrl: '',
method: "GET",
};
if (typeof urlOrRequest === "string") {
r.url = urlOrRequest;
} else if (typeof urlOrRequest === "object") {
Object.assign(r, urlOrRequest);
}
return await XSS.maybe(XSS.parseRequest(r));
}
};
})();