diff options
author | clearnet <clearnet@noreply.codeberg.org> | 2019-08-12 11:55:09 +0200 |
---|---|---|
committer | clearnet <clearnet@noreply.codeberg.org> | 2019-08-12 11:55:09 +0200 |
commit | 48e21486f90a099a29556e588d494ea0892e509e (patch) | |
tree | 8dd37a8c2bc0f075626440184781bbe39ef38014 | |
parent | 5a88c642d3f735b287accf142bfb405b80a2609c (diff) | |
download | cloudflare-tor-48e21486f90a099a29556e588d494ea0892e509e.tar cloudflare-tor-48e21486f90a099a29556e588d494ea0892e509e.tar.gz cloudflare-tor-48e21486f90a099a29556e588d494ea0892e509e.tar.lz cloudflare-tor-48e21486f90a099a29556e588d494ea0892e509e.tar.xz cloudflare-tor-48e21486f90a099a29556e588d494ea0892e509e.zip |
1.0.14.1 GC
-rw-r--r-- | addon_chrome/ismitmlink/bg.js | 28 | ||||
-rw-r--r-- | addon_chrome/ismitmlink/cfg.html | 6 | ||||
-rw-r--r-- | addon_chrome/ismitmlink/cs.js | 72 | ||||
-rw-r--r-- | addon_chrome/ismitmlink/manifest.json | 4 |
4 files changed, 80 insertions, 30 deletions
diff --git a/addon_chrome/ismitmlink/bg.js b/addon_chrome/ismitmlink/bg.js index 0a76ff5a..53f5f638 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') @@ -59,6 +59,9 @@ function forget_cache_1w() { '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) }); chrome.storage.local.set({ @@ -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') @@ -85,6 +88,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { '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') @@ -108,6 +114,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => { '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) }); chrome.storage.local.set({ @@ -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 98f1e017..cce210d4 100644 --- a/addon_chrome/ismitmlink/cfg.html +++ b/addon_chrome/ismitmlink/cfg.html @@ -6,6 +6,12 @@ <label><input type="checkbox" id="ign1"> Ignoru unuan partion FQDN (Ne Rekomendas)</label><br> <label><input type="checkbox" id="ign2"> Ignoru infektitan bildon (Ne Rekomendas)</label><br> <label><input type="checkbox" id="obs"> Ankaŭ skani ligojn aldonitajn de Ĝavaskripto (Rekomendi)</label><br> + <label><input type="checkbox" id="dbg" disabled> Montri demandon en konzolo</label><br> + <br> <br> <br> + Informoj pri kaŝmemoro<br> <br> + Infektita: <input type="text" id="viry" readonly><br> + Ne infektita: <input type="text" id="virn" readonly><br> + Entute: <input type="text" id="viro" readonly><br> <script src="cs.js"></script> </body> </html>
\ No newline at end of file diff --git a/addon_chrome/ismitmlink/cs.js b/addon_chrome/ismitmlink/cs.js index 2cdf0736..d20dc16c 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; + 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; } - 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); - } - }); } - 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 b2b4e7ef..9c4ccc38 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é", |