Run document

This commit is contained in:
Sirisha Gorantala 2022-09-01 10:50:11 +00:00 committed by #deCloudflare
parent ccb48c680d
commit afe15ca305

View File

@ -10,9 +10,6 @@ let done = false,
const baseurl = ['https://karma.crimeflare.eu.org:1984', 'http://karma.im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion']; const baseurl = ['https://karma.crimeflare.eu.org:1984', 'http://karma.im5wixghmfmt7gf7wb4xrgdm6byx2gj26zn47da6nwo7xvybgxnqryid.onion'];
const waitstc = ['Hold on', 'One moment', 'Just a moment', 'Just a sec', 'Just a second', 'Nice find', 'Knock-knock!', 'Brill!', 'Brilliant!', 'Cool!', 'Good going!', 'Good job!', 'Good work!', 'Great!', 'Keep it up!', 'Marvelous!', 'Nice going!', 'Outstanding!', 'Perfect!', 'Right on!', 'Super!', 'Superb!', 'Terrific!', 'Thanks!', 'Wonderful!', 'Wow!', 'You are doing a good job!']; const waitstc = ['Hold on', 'One moment', 'Just a moment', 'Just a sec', 'Just a second', 'Nice find', 'Knock-knock!', 'Brill!', 'Brilliant!', 'Cool!', 'Good going!', 'Good job!', 'Good work!', 'Great!', 'Keep it up!', 'Marvelous!', 'Nice going!', 'Outstanding!', 'Perfect!', 'Right on!', 'Super!', 'Superb!', 'Terrific!', 'Thanks!', 'Wonderful!', 'Wow!', 'You are doing a good job!'];
let domainCAT = {}; let domainCAT = {};
let wblEnabled = false,
wblNOTIFY = false,
wblCats = {};
function showreply(t, d, icon = '') { function showreply(t, d, icon = '') {
browser.notifications.clear(notify); browser.notifications.clear(notify);
browser.notifications.create(notify, { browser.notifications.create(notify, {
@ -993,39 +990,6 @@ if (!done) {
setTimeout(testing_onion, 70000); setTimeout(testing_onion, 70000);
} }
usePOP = (r.nocat95 == 1) ? true : false; usePOP = (r.nocat95 == 1) ? true : false;
wblEnabled = (r.top9 == 1) ? true : false;
wblNOTIFY = (r.black99 == 1) ? true : false;
wblCats = {};
if (r.black02 == 1) {
wblCats['drugs'] = 1;
}
if (r.black03 == 1) {
wblCats['gambling'] = 1;
}
if (r.black17 == 1) {
wblCats['porngore'] = 1;
}
if (r.black07 == 1) {
wblCats['phishing'] = 1;
}
if (r.black09 == 1) {
wblCats['porn'] = 1;
}
if (r.black19 == 1) {
wblCats['pornstrict'] = 1;
}
if (r.black14 == 1) {
wblCats['scamming'] = 1;
}
if (r.black18 == 1) {
wblCats['pornsnuff'] = 1;
}
if (r.black20 == 1) {
wblCats['torrent'] = 1;
}
if (r.black13 == 1) {
wblCats['weapons'] = 1;
}
}); });
reload_menu(); reload_menu();
} }
@ -1053,7 +1017,7 @@ function update_icon(tID, tURL = '') {
return; return;
} }
let _url = new URL(tURL); let _url = new URL(tURL);
if (!lookupCAT || (_url.protocol != 'https:' && _url.protocol != 'http:') || _url.hostname.length < 4) { if ((_url.protocol != 'https:' && _url.protocol != 'http:') || _url.hostname.length < 4) {
browser.browserAction.setIcon({ browser.browserAction.setIcon({
tabId: tID, tabId: tID,
path: 'icon.png' path: 'icon.png'
@ -2162,7 +2126,7 @@ function get_realdomain(w) {
return wa[1] + '.' + wa[0]; return wa[1] + '.' + wa[0];
} }
browser.webRequest.onBeforeRequest.addListener(g => { browser.webRequest.onBeforeRequest.addListener(g => {
if (!g.tabId || (!lookupCAT && !wblEnabled)) { if (!lookupCAT || !g.tabId) {
return; return;
} }
let fqdn = (new URL(g.url)).hostname, let fqdn = (new URL(g.url)).hostname,
@ -2172,31 +2136,22 @@ browser.webRequest.onBeforeRequest.addListener(g => {
} }
if (domainCAT[domain]) { if (domainCAT[domain]) {
domainCAT[domain][0] = tUNIX(); domainCAT[domain][0] = tUNIX();
if (wblEnabled && domainCAT[domain][1] != '' && wblCats[domainCAT[domain][1]] == 1) {
if (wblNOTIFY) {
showreply('Blocked', domain, domainCAT[domain][1]);
}
return {
cancel: true
};
}
return; return;
} }
let isTPR = (g.type == 'main_frame') ? true : false;
domainCAT[domain] = [tUNIX(), '', []];
iGetSiteCat(fqdn).then(g => { iGetSiteCat(fqdn).then(g => {
if (g.length == 2) { if (g.length == 2) {
if (g[0].length >= 4) { if (g[0].length >= 4) {
domainCAT[domain] = [tUNIX(), g[0], g[1]]; domainCAT[domain] = [tUNIX(), g[0], g[1]];
} else {
domainCAT[domain] = [tUNIX(), '', []];
} }
if (lookupCAT && isTPR) { update_icon(null);
update_icon(null);
}
} }
}, b => {}); }, b => {});
}, { }, {
types: ['main_frame'],
urls: ["http://*/*", "https://*/*"] urls: ["http://*/*", "https://*/*"]
}, ["blocking"]); });
function cleanupDomainCAT() { function cleanupDomainCAT() {
let lowat = tUNIX() - 172800; let lowat = tUNIX() - 172800;
for (f in domainCAT) { for (f in domainCAT) {
@ -2291,52 +2246,10 @@ browser.runtime.onMessage.addListener((r, s, sr) => {
} }
if (r[0] == 'top8') { if (r[0] == 'top8') {
lookupCAT = (r[1] == 1) ? true : false; lookupCAT = (r[1] == 1) ? true : false;
if (!lookupCAT && !wblEnabled) { domainCAT = {};
domainCAT = {};
}
update_icon(null); update_icon(null);
sr(true); sr(true);
} }
if (r[0] == 'top9') {
wblEnabled = (r[1] == 1) ? true : false;
sr(true);
}
if (r[0] == 'wbl') {
if (r[1] == 'black99') {
wblNOTIFY = (r[2] == 1) ? true : false;
}
if (r[1] == 'black02') {
wblCats['drugs'] = r[2];
}
if (r[1] == 'black03') {
wblCats['gambling'] = r[2];
}
if (r[1] == 'black17') {
wblCats['porngore'] = r[2];
}
if (r[1] == 'black07') {
wblCats['phishing'] = r[2];
}
if (r[1] == 'black09') {
wblCats['porn'] = r[2];
}
if (r[1] == 'black19') {
wblCats['pornstrict'] = r[2];
}
if (r[1] == 'black14') {
wblCats['scamming'] = r[2];
}
if (r[1] == 'black18') {
wblCats['pornsnuff'] = r[2];
}
if (r[1] == 'black20') {
wblCats['torrent'] = r[2];
}
if (r[1] == 'black13') {
wblCats['weapons'] = r[2];
}
sr(true);
}
if (r[0].startsWith('topWP') || r[0] == 'top4' || r[0] == 'top5' || r[0] == 'top6' || r[0] == 'top7') { if (r[0].startsWith('topWP') || r[0] == 'top4' || r[0] == 'top5' || r[0] == 'top6' || r[0] == 'top7') {
sr(true); sr(true);
} }