0
0
mirror of https://codeberg.org/crimeflare/cloudflare-tor synced 2024-12-23 16:10:35 +00:00
This commit is contained in:
anonymous 2018-11-30 19:47:42 +00:00
parent 548e0c1e41
commit 4b6b2e42c3
11 changed files with 1105 additions and 0 deletions

25
bcma/LICENSE.txt Normal file
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 <pleroma.oniichanylo2tsi4.onion/users/e51638c3>
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.

846
bcma/anticloudflare.js Normal file

File diff suppressed because one or more lines are too long

BIN
bcma/icons/cf_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

BIN
bcma/icons/cf_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

BIN
bcma/icons/icon-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
bcma/icons/icon-48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
bcma/icons/icon-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

42
bcma/manifest.json Normal file
View File

@ -0,0 +1,42 @@
{
"manifest_version": 2,
"name": "Block Cloudflare MITM Attack",
"description": "Submit to global surveillance or resist. The choice is yours.",
"version": "1.0.5.1",
"author": "Project BCMA",
"homepage_url": "https://trac.torproject.org/projects/tor/ticket/24351",
"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_style": false
},
"browser_action": {
"browser_style": false,
"default_icon": {
"32": "icons/cf_0.png"
}
},
"applications": {
"gecko": {
"id": "24351@trac.torproject.org",
"strict_min_version": "52.0"
}
}
}

35
bcma/mydata.html Normal file
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</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> <small>(Default)</small><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><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>

105
bcma/mydata.js Normal file
View File

@ -0,0 +1,105 @@
function onError(e) {
console.log(`Error:${e}`);
}
document.addEventListener('DOMContentLoaded', function () {
browser.runtime.sendMessage(['cf']).then(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 = true;
document.getElementById('ta1').checked = false;
document.getElementById('ta2').checked = false;
document.getElementById('ta3').checked = false;
break;
}
document.body.style.display = 'block';
document.addEventListener('contextmenu', function (z) {
if (z.target.tagName != 'TEXTAREA') {
z.preventDefault();
}
});
} else {
document.getElementById('t').value = '!!! LOAD ERROR !!!';
document.getElementById('g').value = '!!! LOAD ERROR !!!';
}
}, onError);
});
document.getElementById('exp').addEventListener('click', function () {
browser.tabs.create({
active: true,
url: 'about:blank'
}).then(function (t) {
browser.tabs.executeScript(t.id, {
matchAboutBlank: true,
code: "document.documentElement.innerHTML='<html><head><title>Data</title></head><body><pre>'+atob('" + btoa(document.getElementById('t').value) + "')+'</pre></body></html>';window.stop();"
}).then(function (e) {}, onError);
}, onError);
});
document.getElementById('clr').addEventListener('click', function () {
browser.runtime.sendMessage(['erosman']).then(function (r) {
document.getElementById('t').value = '';
}, onError);
});
document.getElementById('bi0').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['bi', 'y']).then(function (r) {}, onError);
}
});
document.getElementById('bi1').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['bi', 'n']).then(function (r) {}, onError);
}
});
document.getElementById('ta0').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['ta', '0']).then(function (r) {}, onError);
}
});
document.getElementById('ta1').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['ta', '1']).then(function (r) {}, onError);
}
});
document.getElementById('ta2').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['ta', '2']).then(function (r) {}, onError);
}
});
document.getElementById('ta3').addEventListener('click', function () {
if (this.checked) {
browser.runtime.sendMessage(['ta', '3']).then(function (r) {}, onError);
}
});
document.getElementById('ign').addEventListener('click', function () {
browser.runtime.sendMessage(['ig', document.getElementById('g').value.split("\n")]).then(function (r) {}, onError);
});

52
bcma/style.css Normal file
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
}