Upload files to 'addons/ismitmlinkFX'

This commit is contained in:
letssync 2020-07-31 01:13:56 +02:00
parent 03a6fe4133
commit 5506daca5c
5 changed files with 1360 additions and 0 deletions

1157
addons/ismitmlinkFX/cg.js Normal file

File diff suppressed because one or more lines are too long

76
addons/ismitmlinkFX/cs.js Normal file
View File

@ -0,0 +1,76 @@
if (document.body && !['ss.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'searxes.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'searxes.eu.org', 'api.searxes.eu.org', 'ansero.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'ansero.eu.org'].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=y]{cursor:not-allowed !important;text-decoration-line:line-through !important;text-decoration-color:red !important;text-decoration-style:double !important}", 0);
cs.insertRule("a[data-mitm=y]::before{content:'[\\26A0]';font-weight:bold !important;color:red !important;display:inline-block !important}", 1);
cs.insertRule("a[data-mitm=y]:hover::before{content:'[\\26A1]'}", 2);
cs.insertRule("a[data-mitm=y]:hover{color:red !important}", 3);
cs.insertRule("img[data-mitm=y]{cursor:not-allowed !important;border:2px red dotted !important}", 4);
cs.insertRule("img[data-mitm=y]:hover{filter:sepia(20%)}", 5);
}
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt']).then(g => {
let asked = ['', 'ss.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'searxes.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'searxes.eu.org', 'api.searxes.eu.org', 'ansero.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion', 'ansero.eu.org', 'addons.mozilla.org', 'addons.thunderbird.net', 'web.archive.org', 't.co'];
if (g.ign1 == 'y') {
asked.push(location.hostname);
}
let qstall = (g.ign2 == 'y') ? 'a[href]:not([data-mitm])' : 'a[href]:not([data-mitm]),img[src]:not([data-mitm])';
let running = false;
function scanme() {
if (!running) {
running = true;
let unknown = [];
document.querySelectorAll(qstall).forEach(a => {
let aF = (a.tagName == 'A' ? (new URL(a.href)).hostname : (new URL(a.src)).hostname) || '';
a.dataset.mitm = aF;
if (!asked.includes(aF)) {
asked.push(aF);
if (!/^(.*)\.(danwin1210\.me|wikipedia\.org|onion|i2p|invalid|test|local|localhost|([0-9]{1,3})|bbs|chan|cyb|dyn|geek|gopher|indy|libre|neo|null|o|oss|oz|parody|pirate|bit|lib|coin|emc|bazar|fur)$/.test(aF) && aF.length >= 4) {
unknown.push(aF);
}
}
});
if (unknown.length > 0) {
browser.runtime.sendMessage(unknown);
}
running = false;
}
}
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.length == 2) {
if (g.dbg == 'y') {
console.log('isMITM:', request[0], request[1]);
}
document.querySelectorAll(g.ign2 == 'y' ? "a[href][data-mitm='" + request[0] + "']" : "a[href][data-mitm='" + request[0] + "'],img[src][data-mitm='" + request[0] + "']").forEach(a => {
if (request[1]) {
a.dataset.mitm = 'y';
if (g.alt == 'y' && a.tagName == 'A') {
if (!a.href.startsWith('https://web.archive.org/web/')) {
a.href = 'https://web.archive.org/web/' + a.href;
}
a.title = 'Arkivo!';
} else {
a.title = 'MITM!';
}
} else {
a.dataset.mitm = 'n';
}
});
}
sendResponse(true);
return;
});
scanme();
if (g.obs == 'y') {
(new MutationObserver(scanme)).observe(document, {
attributes: true,
attributeFilter: ['href'],
childList: true,
subtree: true
});
}
});
}

View File

@ -0,0 +1,17 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>&#128452;</title>
</head>
<body style="display:none">
<br>
<meter id="pbr" value="0" min="0" max="100" style="width:50%"></meter><br><br>
<button type="button" id="ldb_i"> &#x1F4DD; <span tek="opximp"></span> </button>
<button type="button" id="ldb_c"> &#x1F5D1; <span tek="opxclr"></span> </button>
<span style="display:none">
<input type="file" id="f" accept="text/plain">
<span tek="opxdone"></span>
</span>
<script src="localdb.js"></script>
</body>
</html>

View File

@ -0,0 +1,67 @@
let irun = false;
document.addEventListener('DOMContentLoaded', () => {
browser.storage.local.get(['mul']).then(g => {
let ul = g.mul || 'eo';
fetch('i18n/' + ul + '.json', {
method: 'GET'
}).then(j => j.json()).then(j => {
document.querySelectorAll('span[tek]').forEach(x => {
x.innerText = j[x.getAttribute('tek')];
});
document.body.style.display = 'block';
});
});
});
document.getElementById('f').addEventListener('change', e => {
let ff = e.target.files[0];
if (ff) {
let r = new FileReader();
r.addEventListener('load', e => {
if (ff.size > 4) {
let g = e.target.result.replace(/(?:\r\n|\r|\n)/g, "\n").split("\n");
if (g.length > 0) {
browser.storage.local.get(['ldb']).then(gs => {
irun = true;
let cnt0, cnt1 = 0,
gc = 1,
db = JSON.parse(gs.ldb || '[]');
cnt0 = db.length;
document.getElementById('pbr').max = g.length;
g.forEach(x => {
document.getElementById('pbr').value = gc;
gc++;
if (/^([0-9a-z.-]{4,400})\.([a-z]{2,40})$/.test(x) && !db.includes(x)) {
db.push(x);
}
});
g = null;
cnt1 = db.length;
if (cnt1 != cnt0) {
browser.storage.local.set({
'ldb': JSON.stringify(db)
});
}
browser.runtime.sendMessage('dbmode,rl').then(() => {
alert(document.querySelector('span[tek=opxdone]').innerText + "\n\n" + cnt0 + " -> " + cnt1);
location.reload();
});
});
}
}
});
r.readAsText(ff);
}
});
document.getElementById('ldb_i').addEventListener('click', () => {
if (!irun) {
document.getElementById('f').click();
}
});
document.getElementById('ldb_c').addEventListener('click', () => {
if (!irun) {
browser.runtime.sendMessage('dbmode,cl').then(() => {
alert(document.querySelector('span[tek=opxdone]').innerText);
location.reload();
});
}
});

View File

@ -0,0 +1,43 @@
{
"manifest_version": 2,
"name": "Ĉu ligoj estas vundeblaj al MITM-atako?",
"description": "Skanu FQDN uzante la API de Ss",
"version": "1.0.20.2",
"homepage_url": "https://ss.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion/",
"author": "Ss",
"permissions": [
"storage",
"unlimitedStorage"
],
"icons": {
"72": "icons/72.png"
},
"background": {
"scripts": [
"bg.js"
]
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"cs.js"
],
"run_at": "document_end"
}
],
"options_ui": {
"browser_style": true,
"page": "cfg.html"
},
"applications": {
"gecko": {
"id": "ismitmlink@searxes.danwin1210.me",
"strict_min_version": "68.0",
"update_url":"https://api.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion/_/addon.php?for=ismitmlink"
}
}
}