From a4ccdcdb87c8bea6121dd5a1f6e2ea5c5f994380 Mon Sep 17 00:00:00 2001 From: IHateCaptcha Date: Fri, 14 Jun 2019 07:03:57 +0000 Subject: [PATCH] v1.0.8 FX --- addon_firefox/ismitmlink/LICENSE.txt | 5 ++++ addon_firefox/ismitmlink/bg.js | 40 +++++++++++++++++--------- addon_firefox/ismitmlink/cs.js | 8 +++--- addon_firefox/ismitmlink/manifest.json | 2 +- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/addon_firefox/ismitmlink/LICENSE.txt b/addon_firefox/ismitmlink/LICENSE.txt index 8178a5652..0de377dee 100644 --- a/addon_firefox/ismitmlink/LICENSE.txt +++ b/addon_firefox/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_firefox/ismitmlink/bg.js b/addon_firefox/ismitmlink/bg.js index 3486ff3c9..23acc18e0 100644 --- a/addon_firefox/ismitmlink/bg.js +++ b/addon_firefox/ismitmlink/bg.js @@ -1,12 +1,11 @@ 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(() => {}); @@ -50,20 +49,33 @@ function i_already_know_you(f) { }); } -function i_remember_you(f, t) { - browser.storage.local.set({ - [f]: ((t) ? 'y' : 'n') - }); -} - -function clear_cache_week() { +function clear_cache_2w() { browser.storage.local.clear(); + browser.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); setTimeout(function () { - clear_cache_week(); - }, 604800000); + clear_cache_2w(); + }, 1209600000); } -clear_cache_week(); +browser.storage.local.get('lastxU').then(g => { + if (g.lastU) { + if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) { + browser.storage.local.clear(); + browser.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); + } + } else { + browser.storage.local.set({ + 'lastU': Math.round((new Date()).getTime() / 1000) + }); + } + setTimeout(function () { + clear_cache_2w(); + }, 1209600000); +}); browser.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request && sender) { @@ -73,7 +85,9 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => { } if (r == 0) { is_infected(request).then((a) => { - i_remember_you(request, a); + browser.storage.local.set({ + [request]: ((a) ? 'y' : 'n') + }); browser.tabs.sendMessage(sender.tab.id, [request, a]); }, () => { browser.tabs.sendMessage(sender.tab.id, [request, false]); diff --git a/addon_firefox/ismitmlink/cs.js b/addon_firefox/ismitmlink/cs.js index 33468e183..a000b915a 100644 --- a/addon_firefox/ismitmlink/cs.js +++ b/addon_firefox/ismitmlink/cs.js @@ -1,19 +1,19 @@ -if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'searxes.danwin1210.me'].includes(location.hostname)) { +if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.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]{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); browser.runtime.sendMessage(aF); } diff --git a/addon_firefox/ismitmlink/manifest.json b/addon_firefox/ismitmlink/manifest.json index 2c528fb40..c45d4b109 100644 --- a/addon_firefox/ismitmlink/manifest.json +++ b/addon_firefox/ismitmlink/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Are links vulnerable to MITM attack?", "description": "Scan FQDN using Searxes' API", - "version": "1.0.7", + "version": "1.0.8", "homepage_url": "https://notabug.org/crimeflare/cloudflare-tor", "author": "Maslin Bossé", "permissions": [