From cbba07c1e19f7e3fd55ffbf0be4d8f4294241396 Mon Sep 17 00:00:00 2001 From: IHateCaptcha Date: Fri, 14 Jun 2019 07:31:29 +0000 Subject: [PATCH] v1.0.8 GC --- addon_chrome/ismitmlink/LICENSE.txt | 5 ++++ addon_chrome/ismitmlink/bg.js | 41 ++++++++++++++++++--------- addon_chrome/ismitmlink/cs.js | 6 ++-- addon_chrome/ismitmlink/manifest.json | 2 +- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/addon_chrome/ismitmlink/LICENSE.txt b/addon_chrome/ismitmlink/LICENSE.txt index 8178a56528..0de377dee4 100644 --- a/addon_chrome/ismitmlink/LICENSE.txt +++ b/addon_chrome/ismitmlink/LICENSE.txt @@ -1,3 +1,5 @@ +* License + The MIT License Copyright (c) 2019 Maslin Bossé @@ -19,3 +21,6 @@ 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. + + +* Icon file (icons/32.png) by Patricia Clausnitzer diff --git a/addon_chrome/ismitmlink/bg.js b/addon_chrome/ismitmlink/bg.js index ce5525ddf5..5f585ff9ae 100644 --- a/addon_chrome/ismitmlink/bg.js +++ b/addon_chrome/ismitmlink/bg.js @@ -1,17 +1,15 @@ let apiurl = 'https://searxes.eu.org/collab/open/ismitm.php'; -let TORapiurl = 'http://searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion/collab/open/ismitm.php'; fetch('http://xxf4en4djo7hhvatax2g3lvj2qgvbwi4yeyyzwpo25zcog4ewhsbrdyd.onion/ok.php', { method: 'GET', mode: 'cors' }).then(r => r.text()).then(r => { if (r == 'ok') { - apiurl = TORapiurl; + apiurl = 'http://searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion/collab/open/ismitm.php'; } }).catch(() => {}); function is_infected(f) { - console.log(f); return new Promise((g, b) => { fetch(apiurl, { method: 'POST', @@ -49,20 +47,33 @@ function i_already_know_you(f) { }); } -function i_remember_you(f, t) { - chrome.storage.local.set({ - [f]: ((t) ? 'y' : 'n') - }); -} - -function clear_cache_week() { +function clear_cache_2w() { chrome.storage.local.clear(); + chrome.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); setTimeout(function () { - clear_cache(); - }, 604800000); + clear_cache_2w(); + }, 1209600000); } -clear_cache_week(); +chrome.storage.local.get('lastxU', (g) => { + if (g.lastU) { + if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) { + chrome.storage.local.clear(); + chrome.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); + } + } else { + chrome.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); + } + setTimeout(function () { + clear_cache_2w(); + }, 1209600000); +}); chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request) { @@ -72,7 +83,9 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { } if (r == 0) { is_infected(request).then((a) => { - i_remember_you(request, a); + chrome.storage.local.set({ + [request]: ((a) ? 'y' : 'n') + }); chrome.tabs.sendMessage(sender.tab.id, [request, a]); }, () => { chrome.tabs.sendMessage(sender.tab.id, [request, false]); diff --git a/addon_chrome/ismitmlink/cs.js b/addon_chrome/ismitmlink/cs.js index 8ff995a010..0b91709ed5 100644 --- a/addon_chrome/ismitmlink/cs.js +++ b/addon_chrome/ismitmlink/cs.js @@ -5,15 +5,15 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw 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); + cs.insertRule("a[data-mitm]{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]::before{content:'[\\26A0]';font-weight:bold !important;color:red !important;display:inline-block !important}", 1); cs.insertRule("a[data-mitm]:hover::before{content:'[\\26A1]'}", 2); cs.insertRule("a[data-mitm]:hover{color:red !important}", 3); } - let asked = ['searxes.danwin1210.me', 'searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'addons.mozilla.org']; + let asked = ['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'addons.mozilla.org', 'web.archive.org']; 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})|bbs|chan|cyb|dyn|geek|gopher|indy|libre|neo|null|o|oss|oz|parody|pirate|bit|lib|coin|emc|bazar|fur)$/.test(aF) && !asked.includes(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) && !asked.includes(aF)) { asked.push(aF); chrome.runtime.sendMessage(aF); } diff --git a/addon_chrome/ismitmlink/manifest.json b/addon_chrome/ismitmlink/manifest.json index 2f924e19a5..42de8166fe 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.7", + "version": "1.0.8", "minimum_chrome_version": "60", "homepage_url": "https://notabug.org/crimeflare/cloudflare-tor", "author": "Maslin Bossé",