ismitmlink
This commit is contained in:
parent
10598f5506
commit
4a7113db6b
|
@ -0,0 +1,9 @@
|
|||
OSI Approved License Logo
|
||||
|
||||
Copyright 2019 Maslin Bossé
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,26 @@
|
|||
Manifest-Version: 1.0
|
||||
|
||||
Name: bg.js
|
||||
Digest-Algorithms: MD5 SHA1 SHA256
|
||||
MD5-Digest: OBQ4NPzmtRz7SkYLY2WMqA==
|
||||
SHA1-Digest: PYd/WXm+69bZUzZ5qmlDQao7wj0=
|
||||
SHA256-Digest: 1Vp9fbokr9to22h8zNbz8H3M9WIbEscVpvsUNgVdYlA=
|
||||
|
||||
Name: cs.js
|
||||
Digest-Algorithms: MD5 SHA1 SHA256
|
||||
MD5-Digest: pehkupzmo2Ixdt7Q68HAPA==
|
||||
SHA1-Digest: s+CvdyHvxxa2rpcYdfU2vWTLOVc=
|
||||
SHA256-Digest: XHy7dueo5NAeaW3bJk1TAUKnPoqduHEJujbs0/AP//g=
|
||||
|
||||
Name: manifest.json
|
||||
Digest-Algorithms: MD5 SHA1 SHA256
|
||||
MD5-Digest: v5awKiN/PL3zsCJSWElfGQ==
|
||||
SHA1-Digest: Bn8tbrcrML8tXh3Ol2DFIp3q1Hk=
|
||||
SHA256-Digest: +pPySnm5SraoO/eGR+8rl/YYJwX1UmofcBgDNNUGi2Q=
|
||||
|
||||
Name: icons/32.png
|
||||
Digest-Algorithms: MD5 SHA1 SHA256
|
||||
MD5-Digest: 1TJN3KA5ktXGXU6E+e5Hdg==
|
||||
SHA1-Digest: YqHDBsNcYxB3WHZsVdoS5762NmY=
|
||||
SHA256-Digest: XlHfAMRaSBShv6gm2dLkSq91JBr3V1GK3tXJ578ef9s=
|
||||
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
Signature-Version: 1.0
|
||||
MD5-Digest-Manifest: fTcYSTNIMUsCDHgUA2ZP5Q==
|
||||
SHA1-Digest-Manifest: 0Rl4MIkrg3zYRWxdlfeD2+yM1gM=
|
||||
SHA256-Digest-Manifest: WxsHr+ZLaRbnGB6m5UdLXtIqhI/XC2SMzMhSbgLfq8s=
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
const apiurl = 'https://searxes.danwin1210.me/collab/open/ismitm.php';
|
||||
let mymemory = {};
|
||||
|
||||
function ismitm(f) {
|
||||
return new Promise((g, b) => {
|
||||
fetch(apiurl, {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'f=' + f
|
||||
}).then(function (r) {
|
||||
return r.json();
|
||||
}).then(function (r) {
|
||||
if (r[0]) {
|
||||
g(r[1]);
|
||||
} else {
|
||||
b();
|
||||
}
|
||||
}).catch(b);
|
||||
});
|
||||
}
|
||||
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
if (request && sender) {
|
||||
if (mymemory[request] != undefined) {
|
||||
let rlt = mymemory[request];
|
||||
if (Object.keys(mymemory).length > 800) {
|
||||
let cnt = 1;
|
||||
for (let t in mymemory) {
|
||||
if (cnt > 10) {
|
||||
break;
|
||||
}
|
||||
mymemory[t] = null;
|
||||
delete mymemory[t];
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
browser.tabs.sendMessage(sender.tab.id, [request, rlt]);
|
||||
} else {
|
||||
ismitm(request).then(function (a) {
|
||||
mymemory[request] = a;
|
||||
browser.tabs.sendMessage(sender.tab.id, [request, a]);
|
||||
}, function () {
|
||||
browser.tabs.sendMessage(sender.tab.id, [request, false]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,31 @@
|
|||
if (document.body) {
|
||||
if (!['searxes.danwin1210.me', 'searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion'].includes(location.hostname)) {
|
||||
let cs = (function () {
|
||||
let s = document.createElement('style');
|
||||
document.head.appendChild(s);
|
||||
return s.sheet;
|
||||
})();
|
||||
if (cs) {
|
||||
cs.insertRule("a[data-mitm]{text-decoration-line:line-through !important;text-decoration-color:red !important;text-decoration-style:double !important}", 0);
|
||||
}
|
||||
let asked = [location.hostname, 'searxes.danwin1210.me'];
|
||||
document.querySelectorAll("a[href^='http://']:not([data-mitm]),a[href^='https://']:not([data-mitm]),a[href^='//']:not([data-mitm])").forEach(a => {
|
||||
let aF = (new URL(a.href)).hostname;
|
||||
if (!/^(.*)\.(onion|i2p|invalid|test|local|localhost|([0-9]{1,3}))$/.test(aF) && !asked.includes(aF)) {
|
||||
asked.push(aF);
|
||||
browser.runtime.sendMessage(aF);
|
||||
}
|
||||
});
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
if (request.length == 2) {
|
||||
if (request[1]) {
|
||||
document.querySelectorAll("a[href^='http://" + request[0] + "/']:not([data-mitm]),a[href^='https://" + request[0] + "/']:not([data-mitm]),a[href^='//" + request[0] + "/']:not([data-mitm])").forEach(a => {
|
||||
a.dataset.mitm = 1;
|
||||
a.title = 'MITM!';
|
||||
});
|
||||
}
|
||||
}
|
||||
sendResponse(null);
|
||||
});
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Are links vulnerable to MITM attack?",
|
||||
"description": "Scan FQDN using Searxes' API",
|
||||
"version": "1.0.1",
|
||||
"author": "Maslin Bossé",
|
||||
"permissions": [],
|
||||
"icons": {
|
||||
"32": "icons/32.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"bg.js"
|
||||
]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
"js": [
|
||||
"cs.js"
|
||||
],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
],
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "ismitm@searxes.danwin1210.me",
|
||||
"strict_min_version": "56.0"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue