v1.0.8 GC

This commit is contained in:
IHateCaptcha 2019-06-14 07:31:29 +00:00
parent 5e1e2d942d
commit cbba07c1e1
4 changed files with 36 additions and 18 deletions

View File

@ -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 <pc.de>

View File

@ -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) {
function clear_cache_2w() {
chrome.storage.local.clear();
chrome.storage.local.set({
[f]: ((t) ? 'y' : 'n')
'lastU': Math.round((new Date()).getTime() / 1000)
});
setTimeout(function () {
clear_cache_2w();
}, 1209600000);
}
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)
});
}
function clear_cache_week() {
chrome.storage.local.clear();
setTimeout(function () {
clear_cache();
}, 604800000);
} else {
chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
});
}
clear_cache_week();
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]);

View File

@ -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);
}

View File

@ -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é",