Upload files to 'addons/code/ismitmlink'

This commit is contained in:
whitenoise 2021-10-14 10:48:16 +00:00
parent e5995ffabc
commit b75b52d19a
4 changed files with 87 additions and 160 deletions

View File

@ -1,8 +1,15 @@
const apiPublic = [
'https://api.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion/_/is_mitm.php',
'https://api.sercxi.eu.org/_/is_mitm.php',
'http://im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion/api/is_cf.php',
'https://karma.clearnetonion.eu.org/api/is_cf.php'
];
let localUse = -1,
localDB = [],
timr, memcache = {},
forcePurge = false,
apiurl = 'https://0.0.0.0/';
apiurl = 'https://0.0.0.0/',
customAEP = apiPublic[3];
function get_realdomain(w) {
let wa = w.split('.');
let wa_l = wa.length;
@ -1121,122 +1128,9 @@ function i_know_you(f) {
});
});
}
function forget_cache() {
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'cep', 'mul', 'opd', 'ldb']).then(g => {
browser.storage.local.clear();
memcache = {};
browser.storage.local.set({
'ign1': (g.ign1 == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'ign2': (g.ign2 == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'obs': (g.obs == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'dbg': (g.dbg == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'alt': (g.alt == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'cep': (g.cep != undefined ? g.cep : '3')
});
browser.storage.local.set({
'mul': (g.mul != undefined ? g.mul : 'eo')
});
browser.storage.local.set({
'opd': (g.opd != undefined ? g.opd : 'y')
});
browser.storage.local.set({
'ldb': (g.ldb != undefined ? g.ldb : '[]')
});
browser.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
});
browser.storage.local.set({
'lastV': (browser.runtime.getManifest()).version
});
});
clearTimeout(timr);
timr = setTimeout(function () {
forget_cache();
}, 1814400000);
}
browser.storage.local.get(['lastU', 'lastV', 'ldb', 'opd', 'cep']).then(g => {
switch (g.opd) {
case 'n':
localUse = 1;
break;
case 'l':
localUse = 2;
break;
default:
localUse = -1;
break;
}
switch (g.cep) {
case '1':
apiurl = 'https://api.sercxi.eu.org/_/is_mitm.php';
break;
case '2':
apiurl = 'http://im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion/api/is_cf.php';
break;
case '3':
apiurl = 'https://karma.clearnetonion.eu.org/api/is_cf.php';
break;
default:
apiurl = 'https://api.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion/_/is_mitm.php';
break;
}
localDB = JSON.parse(g.ldb || '[]');
if (g.lastU) {
if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1814400) {
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'cep', 'mul', 'opd', 'ldb']).then(g => {
browser.storage.local.clear();
memcache = {};
browser.storage.local.set({
'ign1': (g.ign1 == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'ign2': (g.ign2 == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'obs': (g.obs == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'dbg': (g.dbg == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'alt': (g.alt == 'y' ? 'y' : 'n')
});
browser.storage.local.set({
'cep': (g.cep != undefined ? g.cep : '3')
});
browser.storage.local.set({
'mul': (g.mul != undefined ? g.mul : 'eo')
});
browser.storage.local.set({
'opd': (g.opd != undefined ? g.opd : 'y')
});
browser.storage.local.set({
'ldb': (g.ldb != undefined ? g.ldb : '[]')
});
browser.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
});
});
}
} else {
browser.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
});
}
let nowVer = (browser.runtime.getManifest()).version;
if (g.lastV != nowVer || forcePurge) {
console.log('Updated', nowVer);
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'cep', 'mul', 'opd', 'ldb']).then(g => {
function forget_cache(x) {
if (x) {
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'cep', 'mul', 'opd', 'ldb', 'aep']).then(g => {
browser.storage.local.clear();
memcache = {};
browser.storage.local.set({
@ -1257,6 +1151,9 @@ browser.storage.local.get(['lastU', 'lastV', 'ldb', 'opd', 'cep']).then(g => {
browser.storage.local.set({
'cep': (g.cep != undefined ? g.cep : '3')
});
browser.storage.local.set({
'aep': (g.aep != undefined ? g.aep : apiPublic[3])
});
browser.storage.local.set({
'mul': (g.mul != undefined ? g.mul : 'eo')
});
@ -1274,9 +1171,31 @@ browser.storage.local.get(['lastU', 'lastV', 'ldb', 'opd', 'cep']).then(g => {
});
});
}
clearTimeout(timr);
timr = setTimeout(function () {
forget_cache();
forget_cache(true);
}, 1814400000);
}
browser.storage.local.get(['lastU', 'lastV', 'ldb', 'opd', 'cep', 'aep']).then(g => {
switch (g.opd) {
case 'n':
localUse = 1;
break;
case 'l':
localUse = 2;
break;
default:
localUse = -1;
break;
}
localDB = JSON.parse(g.ldb || '[]');
customAEP = (g.cep == 9 && g.aep) ? g.aep : apiPublic[3];
apiurl = (g.cep == 9) ? customAEP : apiPublic[(g.cep || 3)];
if (g.lastU == undefined || Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1814400 || g.lastV != (browser.runtime.getManifest()).version || forcePurge) {
forget_cache(true);
} else {
forget_cache(false);
}
});
browser.webRequest.onResponseStarted.addListener(r => {
if (localUse == 2) {
@ -1309,7 +1228,23 @@ browser.webRequest.onResponseStarted.addListener(r => {
browser.runtime.onMessage.addListener((requests, sender, sendResponse) => {
if (requests) {
if (requests === 'clear') {
forget_cache();
forget_cache(true);
return;
}
if (requests.indexOf('customaep,') === 0) {
requests = requests.replace('customaep,', '');
if (!/^http(|s):\/\/(.+)\/(.+)/.test(requests)) {
requests = apiPublic[3];
}
browser.storage.local.set({
'aep': requests
});
customAEP = requests;
browser.storage.local.get(['cep']).then(g => {
if (g.cep == 9) {
apiurl = customAEP;
}
});
return;
}
if (requests.indexOf('dbmode,') === 0) {
@ -1352,25 +1287,31 @@ browser.runtime.onMessage.addListener((requests, sender, sendResponse) => {
browser.storage.local.set({
'cep': '0'
});
apiurl = 'https://api.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion/_/is_mitm.php';
apiurl = apiPublic[0];
break;
case 'urltype,1':
browser.storage.local.set({
'cep': '1'
});
apiurl = 'https://api.sercxi.eu.org/_/is_mitm.php';
apiurl = apiPublic[1];
break;
case 'urltype,2':
browser.storage.local.set({
'cep': '2'
});
apiurl = 'http://im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion/api/is_cf.php';
apiurl = apiPublic[2];
break;
case 'urltype,3':
browser.storage.local.set({
'cep': '3'
});
apiurl = 'https://karma.clearnetonion.eu.org/api/is_cf.php';
apiurl = apiPublic[3];
break;
case 'urltype,9':
browser.storage.local.set({
'cep': '9'
});
apiurl = customAEP;
break;
}
return;

View File

@ -12,10 +12,11 @@
<br>&nbsp;<br>
<span tek="opmode"></span><br>
<label><input type="radio" name="opm" id="opon"> <span tek="opmon"></span></label><br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut0"> api.~.onion</label> [ &rarr; <a id="apinfo0" target="_blank">Ss API</a> ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut1"> api.sercxi.eu.org</label> [ &rarr; <a id="apinfo1" target="_blank">Ss API</a> ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut2"> karma.onion</label> [ &rarr; <a href="http://im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion/api/is_cf.php" target="_blank">Karma API</a> ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut3"> karma.clearnetonion.eu.org</label> [ &rarr; <a href="https://karma.clearnetonion.eu.org/api/is_cf.php" target="_blank">Karma API</a> ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut0"> api.~.onion</label>&emsp;<a href="https://sercxi.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion/" target="_blank">&#x1F3E0;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut1"> api.sercxi.eu.org</label>&emsp;<a href="https://sercxi.eu.org/" target="_blank">&#x1F3E0;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut2"> karma.onion</label>&emsp;<a href="http://im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion/api/is_cf.php" target="_blank">&#x1F3E0;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut3"> karma.clearnetonion.eu.org</label>&emsp;<a href="https://karma.clearnetonion.eu.org/api/is_cf.php" target="_blank">&#x1F3E0;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="ut" id="ut9"> API URL</label>&emsp;<input type="text" id="ut9x" style="width:60%" placeholder="ekz. https://karma.clearnetonion.eu.org/api/is_cf.php">&emsp;<a href="http://about-ismm.go.crimeflare.eu.org/" target="_blank">&#128214;</a><br>
<label><input type="radio" name="opm" id="opoff"> <span tek="opmoff"></span></label> [ &rarr; <a href="./localdb.html" target="_blank"><span tek="opmode"></span></a> ]<br>
<label><input type="radio" name="opm" id="opol"> <span tek="opmoff"></span></label> (<span tek="opmlrn"></span>)<br>
<br>&nbsp;<br>

View File

@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', () => {
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'mul', 'opd', 'cep']).then(g => {
browser.storage.local.get(['ign1', 'ign2', 'obs', 'dbg', 'alt', 'mul', 'opd', 'cep', 'aep']).then(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;
@ -8,36 +8,13 @@ document.addEventListener('DOMContentLoaded', () => {
document.getElementById('opon').checked = (g.opd != 'n' && g.opd != 'l') ? true : false;
document.getElementById('opoff').checked = (g.opd == 'n') ? true : false;
document.getElementById('opol').checked = (g.opd == 'l') ? true : false;
switch (g.cep) {
case '1':
document.getElementById('ut0').checked = false;
document.getElementById('ut1').checked = true;
document.getElementById('ut2').checked = false;
document.getElementById('ut3').checked = false;
break;
case '2':
document.getElementById('ut0').checked = false;
document.getElementById('ut1').checked = false;
document.getElementById('ut2').checked = true;
document.getElementById('ut3').checked = false;
break;
case '3':
document.getElementById('ut0').checked = false;
document.getElementById('ut1').checked = false;
document.getElementById('ut2').checked = false;
document.getElementById('ut3').checked = true;
break;
default:
document.getElementById('ut0').checked = true;
document.getElementById('ut1').checked = false;
document.getElementById('ut2').checked = false;
document.getElementById('ut3').checked = false;
break;
}
let ul = g.mul || 'eo';
document.getElementById('apinfo0').href = 'https://sercxi.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion/?ul=' + ul + '#!op=info/api';
document.getElementById('apinfo1').href = 'https://sercxi.eu.org/?ul=' + ul + '#!op=info/api';
fetch('i18n/' + ul + '.json', {
document.getElementById('ut3').checked = (g.cep || 3) == 3 ? true : false;
document.getElementById('ut0').checked = g.cep < 1 ? true : false;
document.getElementById('ut1').checked = g.cep == 1 ? true : false;
document.getElementById('ut2').checked = g.cep == 2 ? true : false;
document.getElementById('ut9').checked = g.cep == 9 ? true : false;
document.getElementById('ut9x').value = (g.aep == undefined || g.aep == 'https://karma.clearnetonion.eu.org/api/is_cf.php') ? '' : g.aep;
fetch('i18n/' + (g.mul || 'eo') + '.json', {
method: 'GET'
}).then(j => j.json()).then(j => {
document.querySelectorAll('span[tek]').forEach(x => {
@ -121,6 +98,14 @@ document.getElementById('ut3').addEventListener('click', () => {
location.reload();
});
});
document.getElementById('ut9').addEventListener('click', () => {
browser.runtime.sendMessage('urltype,9').then(() => {
location.reload();
});
});
document.getElementById('ut9x').addEventListener('change', () => {
browser.runtime.sendMessage('customaep,' + document.getElementById('ut9x').value).then(() => {});
});
function get_realdomain(w) {
let wa = w.split('.');
let wa_l = wa.length;
@ -1182,7 +1167,7 @@ document.getElementById('sms').addEventListener('click', () => {
iN = 0,
iT, tmp, dom, akd = [];
Object.keys(g).forEach(a => {
if (!['ign1', 'ign2', 'obs', 'dbg', 'alt', 'lastU', 'lastV', 'cep', 'mul', 'opd', 'ldb'].includes(a) && (g[a] == 'y' || g[a] == 'n')) {
if (!['ign1', 'ign2', 'obs', 'dbg', 'alt', 'lastU', 'lastV', 'cep', 'mul', 'opd', 'ldb', 'aep'].includes(a) && (g[a] == 'y' || g[a] == 'n')) {
dom = get_realdomain(a);
if (!akd.includes(dom)) {
akd.push(dom);

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "\u0108u ligoj estas vundeblaj al MITM-atako?",
"description": "Skanu FQDN uzante la API",
"version": "1.0.24",
"version": "1.0.25",
"homepage_url": "http://crimeflare.eu.org/",
"author": "Crimeflare",
"permissions": [