0
0
mirror of https://codeberg.org/crimeflare/cloudflare-tor synced 2024-11-07 09:52:40 +00:00

1.0.14.1 GC

This commit is contained in:
clearnet 2019-08-12 11:55:09 +02:00
parent 5a88c642d3
commit 48e21486f9
4 changed files with 81 additions and 31 deletions

View File

@ -46,8 +46,8 @@ function i_already_know_you(f) {
}); });
} }
function forget_cache_1w() { function forget_cache_2w() {
chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => {
chrome.storage.local.clear(); chrome.storage.local.clear();
chrome.storage.local.set({ chrome.storage.local.set({
'ign1': (g.ign1 == 'y' ? 'y' : 'n') 'ign1': (g.ign1 == 'y' ? 'y' : 'n')
@ -58,6 +58,9 @@ function forget_cache_1w() {
chrome.storage.local.set({ chrome.storage.local.set({
'obs': (g.obs == 'y' ? 'y' : 'n') 'obs': (g.obs == 'y' ? 'y' : 'n')
}); });
chrome.storage.local.set({
'dbg': (g.dbg == 'y' ? 'y' : 'n')
});
chrome.storage.local.set({ chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000) 'lastU': Math.round((new Date()).getTime() / 1000)
}); });
@ -66,14 +69,14 @@ function forget_cache_1w() {
}); });
}); });
setTimeout(function () { setTimeout(function () {
forget_cache_1w(); forget_cache_2w();
}, 604800000); }, 1209600000);
} }
chrome.storage.local.get(['lastU', 'lastV'], (g) => { chrome.storage.local.get(['lastU', 'lastV'], (g) => {
if (g.lastU) { if (g.lastU) {
if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 604800) { if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) {
chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { chrome.storage.local.get(['ign1', 'ign2', 'obs', 'dbg'], (g) => {
chrome.storage.local.clear(); chrome.storage.local.clear();
chrome.storage.local.set({ chrome.storage.local.set({
'ign1': (g.ign1 == 'y' ? 'y' : 'n') 'ign1': (g.ign1 == 'y' ? 'y' : 'n')
@ -84,6 +87,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => {
chrome.storage.local.set({ chrome.storage.local.set({
'obs': (g.obs == 'y' ? 'y' : 'n') 'obs': (g.obs == 'y' ? 'y' : 'n')
}); });
chrome.storage.local.set({
'dbg': (g.dbg == 'y' ? 'y' : 'n')
});
chrome.storage.local.set({ chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000) 'lastU': Math.round((new Date()).getTime() / 1000)
}); });
@ -96,7 +102,7 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => {
} }
let nowVer = (chrome.runtime.getManifest()).version; let nowVer = (chrome.runtime.getManifest()).version;
if (g.lastV != nowVer) { 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.clear();
chrome.storage.local.set({ chrome.storage.local.set({
'ign1': (g.ign1 == 'y' ? 'y' : 'n') 'ign1': (g.ign1 == 'y' ? 'y' : 'n')
@ -107,6 +113,9 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => {
chrome.storage.local.set({ chrome.storage.local.set({
'obs': (g.obs == 'y' ? 'y' : 'n') 'obs': (g.obs == 'y' ? 'y' : 'n')
}); });
chrome.storage.local.set({
'dbg': (g.dbg == 'y' ? 'y' : 'n')
});
chrome.storage.local.set({ chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000) 'lastU': Math.round((new Date()).getTime() / 1000)
}); });
@ -116,8 +125,8 @@ chrome.storage.local.get(['lastU', 'lastV'], (g) => {
}); });
} }
setTimeout(function () { setTimeout(function () {
forget_cache_1w(); forget_cache_2w();
}, 604800000); }, 1209600000);
}); });
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
@ -138,4 +147,5 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
} }
}, () => {}); }, () => {});
} }
return;
}); });

View File

@ -6,6 +6,12 @@
<label><input type="checkbox" id="ign1"> Ignoru unuan partion FQDN (Ne Rekomendas)</label><br> <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="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="obs"> Ankaŭ skani ligojn aldonitajn de Ĝavaskripto (Rekomendi)</label><br>
<label><input type="checkbox" id="dbg" disabled> Montri demandon en konzolo</label><br>
<br>&nbsp;<br>&nbsp;<br>
Informoj pri kaŝmemoro<br>&nbsp;<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> <script src="cs.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'api.searxes.eu.org'].includes(location.hostname)) { if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion', 'searxes.eu.org', 'api.searxes.eu.org'].includes(location.hostname)) {
if (location.protocol === 'chrome-extension:') { 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('ign1').checked = (g.ign1 == 'y') ? true : false;
document.getElementById('ign2').checked = (g.ign2 == 'y') ? true : false; document.getElementById('ign2').checked = (g.ign2 == 'y') ? true : false;
document.getElementById('obs').checked = (g.obs == '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') '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 { } else {
let cs = (function () { let cs = (function () {
let s = document.createElement('style'); let s = document.createElement('style');
@ -36,25 +59,32 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw
} }
chrome.storage.local.get(['ign1', 'ign2', 'obs'], (g) => { 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']; 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 qstall = (g.ign2 == 'y') ? 'a[href]:not([data-mitm])' : 'a[href]:not([data-mitm]),img[src]:not([data-mitm])';
let running = false;
function scanme() { function scanme() {
if (!running) {
running = true;
if (location.hostname == 'twitter.com') { if (location.hostname == 'twitter.com') {
document.querySelectorAll("a[href^='https://t.co/'][data-expanded-url^='http']").forEach(a => { document.querySelectorAll("a[href^='https://t.co/'][data-expanded-url^='http']").forEach(a => {
a.href = a.dataset.expandedUrl; a.href = a.dataset.expandedUrl;
}); });
} }
let unknown = [];
document.querySelectorAll(qstall).forEach(a => { document.querySelectorAll(qstall).forEach(a => {
let aF = (a.tagName == 'A' ? (new URL(a.href)).hostname : (new URL(a.src)).hostname) || ''; 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)) { if (!asked.includes(aF)) {
asked.push(aF); asked.push(aF);
chrome.runtime.sendMessage(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) => { chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.length == 2) { if (request.length == 2) {
document.querySelectorAll(qstall).forEach(a => { document.querySelectorAll(qstall).forEach(a => {
@ -70,13 +100,17 @@ if (document.body && !['searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lw
}); });
} }
sendResponse(null); sendResponse(null);
return;
}); });
scanme();
if (g.obs == 'y') { if (g.obs == 'y') {
window.addEventListener('load', function () {
(new MutationObserver(scanme)).observe(document, { (new MutationObserver(scanme)).observe(document, {
attributes: true, attributes: true,
childList: true, childList: true,
subtree: true subtree: true
}); });
});
} }
}); });
} }

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Are links vulnerable to MITM attack?", "name": "Ĉu ligoj estas vundeblaj al MITM-atako?",
"version": "1.0.13", "version": "1.0.14.1",
"minimum_chrome_version": "60", "minimum_chrome_version": "60",
"homepage_url": "https://codeberg.org/crimeflare/cloudflare-tor", "homepage_url": "https://codeberg.org/crimeflare/cloudflare-tor",
"author": "Maslin Bossé", "author": "Maslin Bossé",