From 48e21486f90a099a29556e588d494ea0892e509e Mon Sep 17 00:00:00 2001 From: clearnet Date: Mon, 12 Aug 2019 11:55:09 +0200 Subject: [PATCH] 1.0.14.1 GC --- addon_chrome/ismitmlink/bg.js | 28 ++++++---- addon_chrome/ismitmlink/cfg.html | 6 +++ addon_chrome/ismitmlink/cs.js | 74 +++++++++++++++++++-------- addon_chrome/ismitmlink/manifest.json | 4 +- 4 files changed, 81 insertions(+), 31 deletions(-) diff --git a/addon_chrome/ismitmlink/bg.js b/addon_chrome/ismitmlink/bg.js index 0a76ff5a9..53f5f638f 100644 --- a/addon_chrome/ismitmlink/bg.js +++ b/addon_chrome/ismitmlink/bg.js @@ -46,8 +46,8 @@ function i_already_know_you(f) { }); } -function forget_cache_1w() { - chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { +function forget_cache_2w() { + chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => { chrome.storage.local.clear(); chrome.storage.local.set({ 'ign1': (g.ign1 == 'y' ? 'y' : 'n') @@ -58,6 +58,9 @@ function forget_cache_1w() { chrome.storage.local.set({ 'obs': (g.obs == 'y' ? 'y' : 'n') }); + chrome.storage.local.set({ + 'dbg': (g.dbg == 'y' ? 'y' : 'n') + }); chrome.storage.local.set({ 'lastU': Math.round((new Date()).getTime() / 1000) }); @@ -66,14 +69,14 @@ function forget_cache_1w() { }); }); setTimeout(function () { - forget_cache_1w(); - }, 604800000); + forget_cache_2w(); + }, 1209600000); } chrome.storage.local.get(['lastU', 'lastV'], (g) => { if (g.lastU) { - if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 604800) { - chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { + if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) { + chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => { chrome.storage.local.clear(); chrome.storage.local.set({ 'ign1': (g.ign1 == 'y' ? 'y' : 'n') @@ -84,6 +87,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { chrome.storage.local.set({ 'obs': (g.obs == 'y' ? 'y' : 'n') }); + chrome.storage.local.set({ + 'dbg': (g.dbg == 'y' ? 'y' : 'n') + }); chrome.storage.local.set({ 'lastU': Math.round((new Date()).getTime() / 1000) }); @@ -96,7 +102,7 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { } let nowVer = (chrome.runtime.getManifest()).version; if (g.lastV != nowVer) { - chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { + chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => { chrome.storage.local.clear(); chrome.storage.local.set({ 'ign1': (g.ign1 == 'y' ? 'y' : 'n') @@ -107,6 +113,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { chrome.storage.local.set({ 'obs': (g.obs == 'y' ? 'y' : 'n') }); + chrome.storage.local.set({ + 'dbg': (g.dbg == 'y' ? 'y' : 'n') + }); chrome.storage.local.set({ 'lastU': Math.round((new Date()).getTime() / 1000) }); @@ -116,8 +125,8 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { }); } setTimeout(function () { - forget_cache_1w(); - }, 604800000); + forget_cache_2w(); + }, 1209600000); }); chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { @@ -138,4 +147,5 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { } }, () => {}); } + return; }); \ No newline at end of file diff --git a/addon_chrome/ismitmlink/cfg.html b/addon_chrome/ismitmlink/cfg.html index 98f1e0174..cce210d43 100644 --- a/addon_chrome/ismitmlink/cfg.html +++ b/addon_chrome/ismitmlink/cfg.html @@ -6,6 +6,12 @@


+
+
 
 
+ Informoj pri kaŝmemoro
 
+ Infektita:
+ Ne infektita:
+ Entute:
\ No newline at end of file diff --git a/addon_chrome/ismitmlink/cs.js b/addon_chrome/ismitmlink/cs.js index 2cdf0736d..d20dc16c5 100644 --- a/addon_chrome/ismitmlink/cs.js +++ b/addon_chrome/ismitmlink/cs.js @@ -1,6 +1,6 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'api.searxes.eu.org'].includes(location.hostname)) { if (location.protocol === 'chrome-extension:') { - chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { + chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => { document.getElementById('ign1').checked = (g.ign1 == 'y') ? true : false; document.getElementById('ign2').checked = (g.ign2 == 'y') ? true : false; document.getElementById('obs').checked = (g.obs == 'y') ? true : false; @@ -20,6 +20,29 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw 'obs': (document.getElementById('obs').checked ? 'y' : 'n') }); }); + chrome.storage.local.get(null, (g) => { + let iY = 0, + iN = 0, + iT, tmp; + Object.keys(g).forEach(a => { + if (!['ign1', 'ign2', 'obs', 'dbg', 'lastU', 'lastV'].includes(a)) { + if (g[a] == 'y') { + iY++; + } + if (g[a] == 'n') { + iN++; + } + } + }); + iT = iY + iN; + if (iT > 0) { + tmp = (iY * 100 / iT).toFixed(1); + document.getElementById('viry').value = iY + ' domajnoj (' + tmp + '%)'; + tmp = (iN * 100 / iT).toFixed(1); + document.getElementById('virn').value = iN + ' domajnoj (' + tmp + '%)'; + document.getElementById('viro').value = (iY + iN) + ' domajnoj'; + } + }); } else { let cs = (function () { let s = document.createElement('style'); @@ -36,25 +59,32 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw } chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { let asked = ['', 'searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'api.searxes.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 (location.hostname == 'twitter.com') { - document.querySelectorAll("a[href^='https://t.co/'][data-expanded-url^='http']").forEach(a => { - a.href = a.dataset.expandedUrl; - }); - } - document.querySelectorAll(qstall).forEach(a => { - let aF = (a.tagName == 'A' ? (new URL(a.href)).hostname : (new URL(a.src)).hostname) || ''; - if (!asked.includes(aF) && !/^(.*)\.(danwin1210\.me|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)) { - asked.push(aF); - chrome.runtime.sendMessage(aF); + if (!running) { + running = true; + if (location.hostname == 'twitter.com') { + document.querySelectorAll("a[href^='https://t.co/'][data-expanded-url^='http']").forEach(a => { + a.href = a.dataset.expandedUrl; + }); } - }); + let unknown = []; + document.querySelectorAll(qstall).forEach(a => { + let aF = (a.tagName == 'A' ? (new URL(a.href)).hostname : (new URL(a.src)).hostname) || ''; + if (!asked.includes(aF)) { + asked.push(aF); + if (!/^(.*)\.(danwin1210\.me|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)) { + unknown.push(aF); + } + } + }); + unknown.forEach(a => { + chrome.runtime.sendMessage(a); + }); + running = false; + } } - scanme(); chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request.length == 2) { document.querySelectorAll(qstall).forEach(a => { @@ -70,12 +100,16 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw }); } sendResponse(null); + return; }); + scanme(); if (g.obs == 'y') { - (new MutationObserver(scanme)).observe(document, { - attributes: true, - childList: true, - subtree: true + window.addEventListener('load', function () { + (new MutationObserver(scanme)).observe(document, { + attributes: true, + childList: true, + subtree: true + }); }); } }); diff --git a/addon_chrome/ismitmlink/manifest.json b/addon_chrome/ismitmlink/manifest.json index b2b4e7ef7..9c4ccc38b 100644 --- a/addon_chrome/ismitmlink/manifest.json +++ b/addon_chrome/ismitmlink/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, - "name": "Are links vulnerable to MITM attack?", - "version": "1.0.13", + "name": "Ĉu ligoj estas vundeblaj al MITM-atako?", + "version": "1.0.14.1", "minimum_chrome_version": "60", "homepage_url": "https://codeberg.org/crimeflare/cloudflare-tor", "author": "Maslin Bossé",