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

Upload files to 'addon_chrome/bcma'

This commit is contained in:
writecode 2019-05-06 01:42:59 +00:00
parent 5dcdd7add9
commit 1addecee10
6 changed files with 1095 additions and 0 deletions

View File

@ -0,0 +1,25 @@
The MIT License
Copyright (c) 2017 Project BCMA
Copyright (c) 2017 cypherpunks
Copyright (c) 2017 nullius <nullius@nym.zone>
Copyright (c) 2018 Searxes <searxes.danwin1210.me>
Copyright (c) 2018 Jeff Cliff <@jeffcliff@niu.moe>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
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.

View File

@ -0,0 +1,859 @@
/*
"Welcome to PRISM 2.0"
*/
var cf_flag_ok = 'icons/cf_0.png';
var cf_flag_ng = 'icons/cf_1.png';
var force_whitelist = ['searxes.cf', 'thunderbird.net', 'mozilla.org', 'archive.org', 'cloudflare.com', 'cloudflareapps.com', 'cloudflare-dns.com', 'cloudflarestatus.com', 'cloudflareapi.com', 'cloudflare-ipfs.com', 'cloudflare-quic.com'];
var cfdomains = [];
var known_cf_domains = [];
fetch('bcmadata.txt', {
method: 'GET'
}).then(function (b) {
return b.text();
}).then(function (b) {
cfdomains = b.split("\n").filter(v => v != '');
known_cf_domains = cfdomains;
});
var my_cf_collection = [];
var my_cf_ignore = [];
var my_action = 2;
function onError(e) {
console.log(`BCMA: Error:${e}`);
}
function get_realdomain(w) {
var wa = w.split('.');
wa.reverse();
var wa_l = wa.length;
if (wa_l <= 2) {
return w;
}
if (wa_l >= 3) {
if (wa[0] == 'by' || wa[0] == 'ki' || wa[0] == 'na' || wa[0] == 'tm' || wa[0] == 'vc') {
if (wa[1] == 'com') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'af' || wa[0] == 'bz' || wa[0] == 'lb' || wa[0] == 'lc' || wa[0] == 'mm' || wa[0] == 'mt' || wa[0] == 'ng' || wa[0] == 'sb' || wa[0] == 'sc' || wa[0] == 'sl') {
if (wa[1] == 'com' || wa[1] == 'edu' || wa[1] == 'gov' || wa[1] == 'net' || wa[1] == 'org') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'org') {
if (wa[1] == 'ae') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gg' || wa[0] == 'je') {
if (wa[1] == 'co' || wa[1] == 'net' || wa[1] == 'org') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'name') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
if (wa[0] == 'ag') {
if (['com', 'net', 'org', 'co', 'nom', 'edu', 'gov'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ai') {
if (['off', 'com', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ao') {
if (['co', 'ed', 'it', 'og', 'pb'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ar') {
if (['com', 'edu', 'gov', 'gob', 'int', 'mil', 'net', 'org', 'tur'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'at') {
if (['gv', 'ac', 'co', 'or'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'au') {
if (['com', 'net', 'org', 'edu', 'gov', 'csiro', 'asn', 'id', 'act', 'nsw', 'nt', 'qld', 'sa', 'tas', 'vic', 'wa'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'az') {
if (['biz', 'com', 'edu', 'gov', 'info', 'int', 'mil', 'name', 'net', 'org', 'pp'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ba') {
if (['com', 'co', 'rs'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bd') {
if (['com', 'edu', 'ac', 'net', 'gov', 'org', 'mil'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bh') {
if (['com', 'info', 'cc', 'edu', 'biz', 'net', 'org', 'gov'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bi') {
if (['ac', 'co', 'com', 'edu', 'gouv', 'gov', 'int', 'mil', 'net', 'or', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bn') {
if (['com', 'net', 'org', 'edu'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bo') {
if (['com', 'edu', 'gob', 'gov', 'int', 'mil', 'net', 'org', 'tv'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'br') {
if (['adm', 'adv', 'agr', 'am', 'arq', 'art', 'ato', 'bio', 'blog', 'bmd', 'cim', 'cng', 'cnt', 'com', 'coop', 'ecn', 'edu', 'eng', 'esp', 'etc', 'eti', 'far', 'flog', 'fm', 'fnd', 'fot', 'fst', 'g12', 'ggf', 'gov', 'imb', 'ind', 'inf', 'jor', 'lel', 'mat', 'med', 'mil', 'mus', 'net', 'nom', 'not', 'ntr', 'odo', 'org', 'ppg', 'pro', 'psc', 'psi', 'qsl', 'rec', 'slg', 'srv', 'tmp', 'trd', 'tur', 'tv', 'vet', 'vlog', 'wiki', 'zlg'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'bw') {
if (['org', 'ac', 'co', 'gov'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ci') {
if (['ac', 'co', 'com', 'ed', 'edu', 'go', 'int', 'net', 'or', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ck') {
if (['biz', 'co', 'edu', 'gen', 'gov', 'info', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'cn') {
if (['ac', 'ah', 'bj', 'com', 'cq', 'edu', 'fj', 'gd', 'gov', 'gs', 'gx', 'gz', 'ha', 'hb', 'he', 'hi', 'hk', 'hl', 'hn', 'jl', 'js', 'jx', 'ln', 'mil', 'mo', 'net', 'nm', 'nx', 'org', 'qh', 'sc', 'sd', 'sh', 'sn', 'sx', 'tj', 'tw', 'xj', 'xz', 'yn', 'zj'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'co') {
if (['com', 'edu', 'gov', 'mil', 'net', 'nom', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'com') {
if (['ar', 'br', 'cn', 'de', 'eu', 'gr', 'hu', 'jpn', 'kr', 'no', 'qc', 'ru', 'sa', 'se', 'uk', 'us', 'uy', 'za'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'cr') {
if (['ac', 'co', 'ed', 'fi', 'go', 'or', 'sa'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'cu') {
if (['com', 'edu', 'org', 'net', 'gov', 'inf'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'cy') {
if (['ac', 'biz', 'com', 'ekloges', 'gov', 'ltd', 'name', 'net', 'org', 'parliament', 'press', 'pro', 'tm'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'do') {
if (['art', 'com', 'edu', 'gob', 'gov', 'mil', 'net', 'org', 'sld', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'dz') {
if (['art', 'asso', 'com', 'edu', 'gov', 'net', 'org', 'pol'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ec') {
if (['com', 'info', 'net', 'fin', 'med', 'pro', 'org', 'edu', 'gob', 'gov', 'mil'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ee') {
if (['com', 'pri', 'fie', 'med', 'edu', 'lib', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'eg') {
if (['com', 'edu', 'eun', 'gov', 'mil', 'name', 'net', 'org', 'sci'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'es') {
if (['com', 'nom', 'org', 'gob', 'edu'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'et') {
if (['com', 'gov', 'org', 'edu', 'net', 'biz', 'name', 'info'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'fj') {
if (['ac', 'biz', 'com', 'info', 'mil', 'name', 'net', 'org', 'pro'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ge') {
if (['com', 'edu', 'gov', 'mil', 'net', 'org', 'pvt'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gh') {
if (['com', 'edu', 'gov', 'org', 'mil'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gi') {
if (['com', 'edu', 'gov', 'ltd', 'mod', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gl') {
if (wa[1] == 'co' || wa[1] == 'com') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gr') {
if (['co', 'com', 'edu', 'gov', 'mil', 'mod', 'net', 'org', 'sch'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gt') {
if (['com', 'edu', 'net', 'gob', 'org', 'mil', 'ind'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'gy') {
if (['co', 'com', 'edu', 'gov', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'hk') {
if (['com', 'edu', 'gov', 'idv', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'hn') {
if (['com', 'edu', 'gob', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'hr') {
if (wa[1] == 'com' || wa[1] == 'from') {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'hu') {
if (['2000', 'agrar', 'bolt', 'casino', 'city', 'co', 'erotica', 'erotika', 'film', 'forum', 'games', 'hotel', 'info', 'ingatlan', 'jogasz', 'konyvelo', 'lakas', 'media', 'news', 'org', 'priv', 'reklam', 'sex', 'shop', 'sport', 'suli', 'szex', 'tm', 'tozsde', 'utazas', 'video'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'id') {
if (['ac', 'co', 'go', 'mil', 'net', 'or', 'sch', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'il') {
if (['ac', 'co', 'gov', 'idf', 'k12', 'muni', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'im') {
if (['ac', 'co', 'com', 'gov', 'net', 'org', 'ro'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'in') {
if (['ac', 'co', 'edu', 'ernet', 'firm', 'gen', 'gov', 'ind', 'mil', 'net', 'org', 'res'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'it') {
if (['co', 'edu', 'gov'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'jm') {
if (['com', 'net', 'org', 'edu', 'gov', 'mil'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'jo') {
if (['com', 'edu', 'gov', 'mil', 'name', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'jp') {
if (['ac', 'ad', 'co', 'ed', 'go', 'gr', 'lg', 'ne', 'or'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ke') {
if (['ac', 'co', 'go', 'ne', 'or', 'sc'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'kg') {
if (['com', 'edu', 'gov', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'kh') {
if (['com', 'edu', 'gov', 'mil', 'net', 'org', 'per'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'kr') {
if (['ac', 'busan', 'chungbuk', 'chungnam', 'co', 'daegu', 'daejeon', 'es', 'gangwon', 'go', 'gwangju', 'gyeongbuk', 'gyeonggi', 'gyeongnam', 'hs', 'incheon', 'jeju', 'jeonbuk', 'jeonnam', 'kg', 'mil', 'ms', 'ne', 'or', 'pe', 're', 'sc', 'seoul', 'ulsan'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'kw') {
if (['edu', 'com', 'net', 'org', 'gov'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'kz') {
if (['com', 'edu', 'gov', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'lk') {
if (['assn', 'com', 'edu', 'gov', 'grp', 'hotel', 'int', 'ltd', 'net', 'ngo', 'org', 'sch', 'soc', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ls') {
if (['ac', 'co', 'gov', 'net', 'nul', 'org', 'parliament', 'quadrant'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'lv') {
if (['asn', 'com', 'conf', 'edu', 'gov', 'id', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ly') {
if (['com', 'edu', 'gov', 'id', 'med', 'net', 'org', 'plc', 'sch'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ma') {
if (['ac', 'co', 'gov', 'net', 'org', 'press'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'mk') {
if (['com', 'edu', 'gov', 'inf', 'name', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'mu') {
if (['ac', 'co', 'com', 'gov', 'net', 'or', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'mx') {
if (['com', 'edu', 'gob', 'net', 'ngo', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'my') {
if (['com', 'edu', 'gov', 'mil', 'name', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'mz') {
if (['co', 'net', 'org', 'ac', 'gov', 'edu'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'net') {
if (['gb', 'se', 'uk', 'jp'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'nf') {
if (['com', 'net', 'arts', 'store', 'web', 'firm', 'info', 'other', 'per', 'rec'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ni') {
if (['gob', 'co', 'com', 'ac', 'edu', 'org', 'nom', 'net', 'mil'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'np') {
if (['aero', 'asia', 'biz', 'com', 'coop', 'edu', 'gov', 'info', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'pro', 'travel'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'nr') {
if (['biz', 'com', 'edu', 'gov', 'info', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'nz') {
if (['ac', 'co', 'cri', 'geek', 'gen', 'govt', 'health', 'iwi', 'maori', 'mil', 'net', 'org', 'parliament', 'school'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'om') {
if (['co', 'com', 'edu', 'gov', 'med', 'museum', 'net', 'org', 'pro'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pa') {
if (['abo', 'ac', 'com', 'edu', 'gob', 'ing', 'med', 'net', 'nom', 'org', 'sld'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pe') {
if (['com', 'edu', 'gob', 'mil', 'net', 'nom', 'org', 'sld'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pg') {
if (['com', 'net', 'ac', 'gov', 'mil', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ph') {
if (['com', 'edu', 'gov', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pk') {
if (['biz', 'com', 'edu', 'fam', 'gob', 'gok', 'gon', 'gop', 'gos', 'gov', 'net', 'org', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pl') {
if (['art', 'bialystok', 'biz', 'com', 'edu', 'gda', 'gdansk', 'gov', 'info', 'katowice', 'krakow', 'lodz', 'lublin', 'mil', 'net', 'ngo', 'olsztyn', 'org', 'poznan', 'radom', 'slupsk', 'szczecin', 'torun', 'warszawa', 'waw', 'wroc', 'wroclaw', 'zgora'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pn') {
if (['in', 'co', 'eu', 'org', 'net', 'me'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pr') {
if (['ac', 'biz', 'com', 'edu', 'est', 'gov', 'info', 'isla', 'name', 'net', 'org', 'pro', 'prof'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'pt') {
if (['com', 'edu', 'gov', 'int', 'net', 'nome', 'org', 'publ'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'py') {
if (['com', 'coop', 'edu', 'mil', 'gov', 'org', 'net', 'una'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'qa') {
if (['com', 'edu', 'sch', 'gov', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ru') {
if (['ac', 'adygeya', 'altai', 'amur', 'amursk', 'arkhangelsk', 'astrakhan', 'baikal', 'bashkiria', 'belgorod', 'bir', 'bryansk', 'buryatia', 'cap', 'cbg', 'chel', 'chelyabinsk', 'chita', 'chukotka', 'cmw', 'com', 'dagestan', 'e-burg', 'edu', 'fareast', 'gov', 'grozny', 'int', 'irkutsk', 'ivanovo', 'izhevsk', 'jamal', 'jar', 'joshkar-ola', 'k-uralsk', 'kalmykia', 'kaluga', 'kamchatka', 'karelia', 'kazan', 'kchr', 'kemerovo', 'khabarovsk', 'khakassia', 'khv', 'kirov', 'kms', 'koenig', 'komi', 'kostroma', 'krasnoyarsk', 'kuban', 'kurgan', 'kursk', 'kustanai', 'kuzbass', 'lipetsk', 'magadan', 'magnitka', 'mari', 'mari-el', 'marine', 'mil', 'mordovia', 'mos', 'mosreg', 'msk', 'murmansk', 'mytis', 'nakhodka', 'nalchik', 'net', 'nkz', 'nnov', 'norilsk', 'nov', 'novosibirsk', 'nsk', 'omsk', 'orenburg', 'org', 'oryol', 'oskol', 'palana', 'penza', 'perm', 'pp', 'pskov', 'ptz', 'pyatigorsk', 'rnd', 'rubtsovsk', 'ryazan', 'sakhalin', 'samara', 'saratov', 'simbirsk', 'smolensk', 'snz', 'spb', 'stavropol', 'stv', 'surgut', 'syzran', 'tambov', 'tatarstan', 'test', 'tlt', 'tom', 'tomsk', 'tsaritsyn', 'tsk', 'tula', 'tuva', 'tver', 'tyumen', 'udm', 'udmurtia', 'ulan-ude', 'vdonsk', 'vladikavkaz', 'vladimir', 'vladivostok', 'volgograd', 'vologda', 'voronezh', 'vrn', 'vyatka', 'yakutia', 'yamal', 'yaroslavl', 'yekaterinburg', 'yuzhno-sakhalinsk', 'zgrad'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'sa') {
if (['com', 'edu', 'gov', 'med', 'net', 'org', 'pub', 'sch'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'se') {
if (['a', 'ac', 'b', 'bd', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'o', 'org', 'p', 'parti', 'pp', 'press', 'r', 's', 't', 'tm', 'u', 'w', 'x', 'y', 'z'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'sg') {
if (['com', 'edu', 'gov', 'idn', 'net', 'org', 'per'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'sv') {
if (['edu', 'gov', 'com', 'org', 'red'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'th') {
if (['ac', 'co', 'go', 'in', 'mi', 'net', 'or'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'tj') {
if (['ac', 'aero', 'biz', 'co', 'com', 'coop', 'dyn', 'edu', 'go', 'gov', 'info', 'int', 'mil', 'museum', 'my', 'name', 'net', 'nic', 'org', 'per', 'pro', 'test', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'tn') {
if (['agrinet', 'com', 'defense', 'edunet', 'ens', 'fin', 'gov', 'ind', 'info', 'intl', 'mincom', 'nat', 'net', 'org', 'perso', 'rnrt', 'rns', 'rnu', 'tourism'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'tr') {
if (['av', 'bbs', 'bel', 'biz', 'com', 'dr', 'edu', 'gen', 'gov', 'info', 'k12', 'mil', 'name', 'nc', 'net', 'org', 'pol', 'tel', 'tv', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'tw') {
if (['club', 'com', 'ebiz', 'edu', 'game', 'gov', 'idv', 'mil', 'net', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'tz') {
if (['co', 'ac', 'go', 'or', 'mil', 'sc', 'ne', 'hotel', 'mobi', 'tv', 'info', 'me'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ua') {
if (['at', 'cherkassy', 'chernigov', 'chernovtsy', 'ck', 'cn', 'co', 'com', 'crimea', 'cv', 'dn', 'dnepropetrovsk', 'donetsk', 'dp', 'edu', 'gov', 'if', 'in', 'ivano-frankivsk', 'kh', 'kharkov', 'kherson', 'khmelnitskiy', 'kiev', 'kirovograd', 'km', 'kr', 'ks', 'lg', 'lt', 'lugansk', 'lutsk', 'lviv', 'mk', 'net', 'nikolaev', 'od', 'odessa', 'org', 'pl', 'poltava', 'pp', 'rovno', 'rv', 'sebastopol', 'sumy', 'te', 'ternopil', 'uz', 'uzhgorod', 'vinnica', 'vn', 'yalta', 'zaporizhzhe', 'zhitomir', 'zp', 'zt'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ug') {
if (['co', 'ac', 'sc', 'go', 'ne', 'or'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'uk') {
if (['ac', 'bl', 'british-library', 'co', 'gov', 'jcpc', 'jet', 'judiciary', 'ltd', 'me', 'mod', 'net', 'nhs', 'nic', 'nls', 'org', 'parliament', 'plc', 'police', 'sch', 'supremecourt'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'uy') {
if (['com', 'edu', 'gub', 'net', 'mil', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'uz') {
if (['co', 'com', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 've') {
if (['arts', 'co', 'com', 'edu', 'gob', 'gov', 'info', 'int', 'mil', 'net', 'org', 'radio', 'tec', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'vi') {
if (['co', 'org', 'com', 'net', 'k12'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'vn') {
if (['ac', 'biz', 'com', 'edu', 'gov', 'health', 'info', 'int', 'mil', 'name', 'net', 'org', 'pro'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'ws') {
if (['org', 'gov', 'edu', 'com'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'za') {
if (['ac', 'agric', 'alt', 'bourse', 'city', 'co', 'cybernet', 'db', 'edu', 'gov', 'grondar', 'iaccess', 'imt', 'inca', 'landesign', 'law', 'mil', 'ngo', 'nis', 'nom', 'olivetti', 'org', 'pix', 'school', 'tm', 'web'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'zm') {
if (['ac', 'co', 'com', 'edu', 'gov', 'net', 'org', 'sch'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa[0] == 'zw') {
if (['co', 'ac', 'org'].includes(wa[1])) {
return wa[2] + "." + wa[1] + "." + wa[0];
}
}
if (wa_l == 4) {
if (/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(w)) {
return w;
}
}
}
return wa[1] + "." + wa[0];
}
function update_icon(tid, url) {
if (url == undefined) {
return;
}
var _nu = new URL(url);
var cf_hostname = _nu.hostname;
if ((_nu.protocol != 'http:' && _nu.protocol != 'https:') || cf_hostname.length < 1) {
chrome.browserAction.setIcon({
tabId: tid,
path: cf_flag_ok
});
return;
}
cf_hostname = get_realdomain(cf_hostname);
if (my_cf_ignore.includes(cf_hostname) || force_whitelist.includes(cf_hostname)) {
chrome.browserAction.setIcon({
tabId: tid,
path: cf_flag_ok
});
return;
}
if (known_cf_domains.includes(cf_hostname) || my_cf_collection.includes(cf_hostname)) {
if (my_action == 3) {
chrome.tabs.executeScript(tid, {
matchAboutBlank: true,
runAt: 'document_end',
code: "if (location.hostname=='%%CFHOST%%'||location.hostname.endsWith('.%%CFHOST%%')){if (!document.title.startsWith('[!!MITM!!]') && (typeof _bcma_bdr)=='undefined'){document.title='[!!MITM!!]'+document.title;function _bcma_bdr(){document.body.style = 'border:4px dashed #' + ['e74c3c', '9b59b6', '3498db', '17a589', '196f3d', 'f4d03f', 'f39c12', 'd35400'][Math.floor(Math.random() * 8)] + ' !important';setTimeout(_bcma_bdr,4860);};_bcma_bdr();}}".replace('%%CFHOST%%', cf_hostname).replace('%%CFHOST%%', cf_hostname)
});
chrome.tabs.executeScript(tid, {
matchAboutBlank: true,
runAt: 'document_idle',
code: "if (location.hostname=='%%CFHOST%%'||location.hostname.endsWith('.%%CFHOST%%')){if (!document.title.startsWith('[!!MITM!!]') && (typeof _bcma_bdr)=='undefined'){document.title='[!!MITM!!]'+document.title;function _bcma_bdr(){document.body.style = 'border:4px dashed #' + ['e74c3c', '9b59b6', '3498db', '17a589', '196f3d', 'f4d03f', 'f39c12', 'd35400'][Math.floor(Math.random() * 8)] + ' !important';setTimeout(_bcma_bdr,4860);};_bcma_bdr();}}".replace('%%CFHOST%%', cf_hostname).replace('%%CFHOST%%', cf_hostname)
});
}
chrome.browserAction.setIcon({
tabId: tid,
path: cf_flag_ng
});
return;
}
chrome.browserAction.setIcon({
tabId: tid,
path: cf_flag_ok
});
return;
}
chrome.webRequest.onHeadersReceived.addListener(function (wr) {
if (wr.type != 'main_frame' && my_action == 2) {
return;
}
var _a = document.createElement('a');
_a.setAttribute('href', wr.url);
var wr_protocol = _a.protocol;
var wr_hostname = _a.hostname;
_a = null;
if ((wr_protocol != 'http:' && wr_protocol != 'https:') || wr_hostname.length < 4) {
return;
}
wr_hostname = get_realdomain(wr_hostname);
if (my_action == 1) {
if (wr.type == 'main_frame') {
return;
}
if (wr.documentUrl) {
var _b = document.createElement('a');
_b.setAttribute('href', wr.documentUrl);
if (wr_hostname == get_realdomain(_b.hostname)) {
return;
}
_b = null;
}
}
if (my_cf_ignore.includes(wr_hostname)) {
return;
}
if (force_whitelist.includes(wr_hostname)) {
return;
}
var cf_is = (known_cf_domains.includes(wr_hostname) || my_cf_collection.includes(wr_hostname)) ? true : false;
if (!cf_is) {
var cf_headers = wr.responseHeaders,
cf_v_name, cf_v_value;
for (var i = 0; i < cf_headers.length; i++) {
cf_v_name = cf_headers[i]['name'].toLowerCase();
cf_v_value = (cf_headers[i]['value'] != undefined) ? cf_headers[i]['value'].toLowerCase() : '';
if (cf_v_name == 'server' && cf_v_value.includes('cloudflare')) {
cf_is = true;
break;
}
if (cf_v_name == 'cf-ray' || cf_v_name == 'cf-cache-status' || cf_v_name == 'cf-chl-bypass') {
cf_is = true;
break;
}
if (cf_v_name == 'set-cookie' && cf_v_value.includes('_cfduid')) {
cf_is = true;
break;
}
}
}
if (cf_is) {
if (my_cf_collection.length > 500) {
my_cf_collection.shift();
}
if (!my_cf_collection.includes(wr_hostname)) {
my_cf_collection.push(wr_hostname);
}
console.log('BCMA: Block Cloudflare RH', wr_hostname);
if (my_action == 0 || my_action == 1) {
if (wr.type == 'image') {
return {
redirectUrl: 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgAAACwAAAAAAQABAAACAkQBADs='
};
} else {
return {
cancel: true
};
}
}
if (my_action == 2) {
return {
redirectUrl: 'https://web.archive.org/web/' + wr.url.split('?')[0]
};
}
}
return;
}, {
urls: ["http://*/*", "https://*/*"]
}, ["blocking", "responseHeaders"]);
chrome.webRequest.onBeforeRequest.addListener(function (wr) {
if (wr.type != 'main_frame' && my_action == 2) {
return;
}
var _a = document.createElement('a');
_a.setAttribute('href', wr.url);
var wr_protocol = _a.protocol;
var wr_hostname = _a.hostname;
_a = null;
if ((wr_protocol != 'http:' && wr_protocol != 'https:') || wr_hostname.length < 4) {
return;
}
wr_hostname = get_realdomain(wr_hostname);
if (my_action == 1) {
if (wr.type == 'main_frame') {
return;
}
if (wr.documentUrl) {
var _b = document.createElement('a');
_b.setAttribute('href', wr.documentUrl);
if (wr_hostname == get_realdomain(_b.hostname)) {
return;
}
_b = null;
}
}
if (my_cf_ignore.includes(wr_hostname)) {
return;
}
if (force_whitelist.includes(wr_hostname)) {
return;
}
var cf_is = (known_cf_domains.includes(wr_hostname) || my_cf_collection.includes(wr_hostname)) ? true : false;
if (cf_is) {
console.log('BCMA: Block Cloudflare BR', wr_hostname);
if (my_action == 0 || my_action == 1) {
if (wr.type == 'image') {
return {
redirectUrl: 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgAAACwAAAAAAQABAAACAkQBADs='
};
} else {
return {
cancel: true
};
}
}
if (my_action == 2) {
return {
redirectUrl: 'https://web.archive.org/web/' + wr.url.split('?')[0]
};
}
}
return;
}, {
urls: ["http://*/*", "https://*/*"]
}, ["blocking"]);
chrome.runtime.onMessage.addListener(function (a, b, c) {
if (a[0] == 'cf') {
c(['ok', JSON.stringify(my_cf_collection), JSON.stringify(my_cf_ignore), (known_cf_domains.length == 0) ? false : true, my_action]);
}
if (a[0] == 'erosman') {
my_cf_collection = [];
c(['destroy']);
}
if (a[0] == 'bi') {
if (a[1] == 'y') {
known_cf_domains = cfdomains;
} else {
known_cf_domains = [];
}
c(['ok']);
}
if (a[0] == 'ta') {
if (a[1] == '0') {
my_action = 0;
}
if (a[1] == '1') {
my_action = 1;
}
if (a[1] == '2') {
my_action = 2;
}
if (a[1] == '3') {
my_action = 3;
}
c(['ok']);
}
if (a[0] == 'ig') {
my_cf_ignore = a[1].sort().filter(v => v != '');
c(['ok']);
}
return true;
});
chrome.tabs.onActivated.addListener(function (i) {
chrome.tabs.query({
active: true,
currentWindow: true
}, function (t) {
if (t[0]){update_icon(t[0].id, t[0].url);}
});
});
chrome.tabs.onUpdated.addListener(function (a, b, t) {
if (t.active) {
update_icon(t.id, t.url);
}
});
chrome.webNavigation.onDOMContentLoaded.addListener(function (d1, d2, d3) {
chrome.tabs.query({
active: true,
currentWindow: true
}, function (t) {
update_icon(t[0].id, t[0].url);
});
});
chrome.webNavigation.onCompleted.addListener(function (d1, d2, d3) {
chrome.tabs.query({
active: true,
currentWindow: true
}, function (t) {
update_icon(t[0].id, t[0].url);
});
});
chrome.browserAction.onClicked.addListener(function (t) {
chrome.runtime.openOptionsPage();
});

View File

@ -0,0 +1,36 @@
{
"manifest_version": 2,
"name": "Block Cloudflare MITM Attack",
"description": "Submit to global surveillance or resist. The choice is yours.",
"version": "1.0.1905.1",
"minimum_chrome_version": "60",
"author": "Project BCMA",
"homepage_url": "https://notabug.org/themusicgod1/cloudflare-tor",
"incognito": "split",
"permissions": [
"<all_urls>",
"activeTab",
"tabs",
"webRequest",
"webRequestBlocking",
"webNavigation"
],
"icons": {
"32": "icons/icon-32.png",
"48": "icons/icon-48.png",
"64": "icons/icon-64.png"
},
"background": {
"scripts": [
"anticloudflare.js"
]
},
"options_ui": {
"page": "mydata.html"
},
"browser_action": {
"default_icon": {
"32": "icons/cf_0.png"
}
}
}

View File

@ -0,0 +1,35 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body style="display:none">
Temporary configurations
<hr>
<b>&#9758; Built-in Cloudflare list (.com only)</b> <small>(powered by <a href="https://searxes.danwin1210.me/" target="_blank">Searxes</a>)</small><br>
<label><input type="radio" id="bi0" name="bi" value="0"> Use built-in list</label> <small>(Default)</small><br>
<label><input type="radio" id="bi1" name="bi" value="1"> Don't use built-in list</label><br>
<br>
<b>&#9822; Take Action</b><br>
<label><input type="radio" id="ta0" name="ta" value="0"> Block request immediately <small>(first-party + third-party)</small></label><br>
<label><input type="radio" id="ta1" name="ta" value="1"> Block request immediately <small>(third-party only / ignore first-party)</small></label><br>
<label><input type="radio" id="ta2" name="ta" value="2"> Redirect to Internet Archive(first-party) + Ignore third-party</label> <small>(Default)</small><br>
<label><input type="radio" id="ta3" name="ta" value="3"> Notify only</label><br>
<br>
<b>&#9997; Your Cloudflare Domain collection</b> <small>(Last 500)</small><br>
<small>(please share with <a href="https://notabug.org/themusicgod1/cloudflare-tor/" target="_blank">cloudflare-tor@notabug</a>)</small><br>
<textarea cols="50" rows="12" id="t" wrap="off" spellcheck="false" placeholder="Cloudflare domains"></textarea>
<br>
<button type="button" id="exp">[ &#8659; Export ]</button>
&nbsp;&nbsp;
<button type="button" id="clr">[ &#8634; Clear ]</button><br>
<br>
<b>&#9997; Your Cloudflare Ignore list (NOT RECOMMEND!)</b><br>
<textarea cols="50" rows="10" id="g" wrap="off" spellcheck="false" placeholder="hypothes.is"></textarea>
<br>
<button type="button" id="ign">[ &#8657; Apply ]</button>
<hr>
"<i>Welcome to PRISM 2.0</i>"
<script src="mydata.js"></script>
</body>
</html>

View File

@ -0,0 +1,88 @@
document.addEventListener('DOMContentLoaded', function () {
chrome.runtime.sendMessage(['cf'], function (r) {
if (r[0] == 'ok') {
document.getElementById('t').value = JSON.parse(r[1]).join("\n");
document.getElementById('g').value = JSON.parse(r[2]).join("\n");
if (r[3]) {
document.getElementById('bi0').checked = true;
document.getElementById('bi1').checked = false;
} else {
document.getElementById('bi0').checked = false;
document.getElementById('bi1').checked = true;
}
switch (r[4]) {
case 1:
document.getElementById('ta0').checked = false;
document.getElementById('ta1').checked = true;
document.getElementById('ta2').checked = false;
document.getElementById('ta3').checked = false;
break;
case 2:
document.getElementById('ta0').checked = false;
document.getElementById('ta1').checked = false;
document.getElementById('ta2').checked = true;
document.getElementById('ta3').checked = false;
break;
case 3:
document.getElementById('ta0').checked = false;
document.getElementById('ta1').checked = false;
document.getElementById('ta2').checked = false;
document.getElementById('ta3').checked = true;
break;
default:
document.getElementById('ta0').checked = false;
document.getElementById('ta1').checked = false;
document.getElementById('ta2').checked = true;
document.getElementById('ta3').checked = false;
break;
}
document.body.style.display = 'block';
document.addEventListener('contextmenu', function (z) {
if (z.target.tagName != 'TEXTAREA') {
z.preventDefault();
}
});
}
});
});
document.getElementById('exp').style.display = 'none';
document.getElementById('clr').addEventListener('click', function () {
chrome.runtime.sendMessage(['erosman'], function (r) {
document.getElementById('t').value = '';
});
});
document.getElementById('bi0').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['bi', 'y']);
}
});
document.getElementById('bi1').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['bi', 'n']);
}
});
document.getElementById('ta0').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['ta', '0']);
}
});
document.getElementById('ta1').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['ta', '1']);
}
});
document.getElementById('ta2').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['ta', '2']);
}
});
document.getElementById('ta3').addEventListener('click', function () {
if (this.checked) {
chrome.runtime.sendMessage(['ta', '3']);
}
});
document.getElementById('ign').addEventListener('click', function () {
chrome.runtime.sendMessage(['ig', document.getElementById('g').value.split("\n")]);
});

View File

@ -0,0 +1,52 @@
*::-moz-focus-inner {
border: 0
}
*:focus {
outline: none;
outline-style: none
}
button {
background-color: transparent;
background-repeat: no-repeat;
border: 0;
overflow: hidden;
outline: none;
outline-style: none
}
body {
font: 13px Verdana;
overflow-x: hidden;
-webkit-user-select: none;
-moz-user-select: none;
cursor: default
}
button {
display: inline-block;
height: 27px
}
div {
-webkit-user-select: none;
-moz-user-select: none
}
hr {
color: #dcdcdc;
height: 0;
background: #dcdcdc
}
label {
-webkit-user-select: none;
-moz-user-select: none
}
textarea {
white-space: pre;
overflow-wrap: normal;
overflow-x: scroll
}