first commit

This commit is contained in:
Andrei O 2022-03-25 20:10:48 +02:00
commit d78b27c29a
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
18 changed files with 452 additions and 0 deletions

7
.prettierrc Normal file
View File

@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 150,
"trailingComma": "all",
"singleQuote": true
}

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"prettier.enable": true,
"editor.formatOnSave": true
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Andrei O.
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.

13
PRIVACY_POLICY.md Normal file
View File

@ -0,0 +1,13 @@
# 𝐏𝐫𝐢𝐯𝐚𝐜𝐲 𝐏𝐨𝐥𝐢𝐜𝐲:
## Privacy Points:
- This extension does not collect any data form your device.
- This extension does not use external files, everything is packed into the extension.
- This extension uses the manifest V3 which does not allow any third party scripts to be injected.
- The extension needs host permissions to inject a script to modify the navigator object.
- This extension is completely open source, the source is available on Github - [https://https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension](https://https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension).
### 𝐂𝐨𝐧𝐭𝐚𝐜𝐭:
Discord: andrei0x309#6562

31
README.md Normal file
View File

@ -0,0 +1,31 @@
# Brave Detection Block BDB (chrome extension):
![BDB LOGO](/images/BDB-ICON256.png?raw=true "BDB LOGO")
Although Brave is a good privacy browser it has some features that are pretty against privacy like an official method for website to detect you are running brave.
This method is by cheking a custom property on the navigator object, accessable at `window.navigator.brave`.
This is probably a point where marketing and data collection coliedes with any privacy ethos.
This extension is ment to delete that property and make it impossible to detect if you are running brave using that method.
Download from Chrome-Store(only download if you are running Brave):
[Brave-Detection-Blocker-Chrome-Extension](https://https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension)
## Privacy Policy Link:
[PRIVACY_POLICY.md](PRIVACY_POLICY.md)
### License:
MIT
### Notes:
This extension was made to be compatible with [Random User Agent](https://github.com/tarampampam/random-user-agent/) extension.
### 𝐂𝐨𝐧𝐭𝐚𝐜𝐭:
Discord: andrei0x309#6562

10
_locales/en/messages.json Normal file
View File

@ -0,0 +1,10 @@
{
"appName": {
"message": "Brave Detection Block",
"description": "This extension blocks the official method to detect you use brave browser, install only on Brave browser."
},
"appDesc": {
"message": "Brave Detection Block",
"description": "This extension blocks the official method to detect you use brave browser, install only on Brave browser."
}
}

28
block-script.js Normal file
View File

@ -0,0 +1,28 @@
function Navigator() {}
newNav = new Navigator();
const alreadyProxifiedNav = {
userAgent: navigator.userAgent,
appVersion: navigator.appVersion,
platform: navigator.platform,
vendor: navigator.vendor,
};
for (let prop in window.navigator) {
if (prop === 'brave') {
continue;
}
Object.defineProperty(newNav, prop, {
value: window.navigator[prop],
writable: true,
});
}
for (let prop in alreadyProxifiedNav) {
alreadyProxifiedNav.hasOwnProperty(prop) &&
Object.defineProperty(newNav, prop, {
value: alreadyProxifiedNav[prop],
writable: true,
});
}
Object.defineProperty(window, 'navigator', {
value: newNav,
writable: true,
});

17
content-script.js Normal file
View File

@ -0,0 +1,17 @@
const nullthrows = (v) => {
if (v == null) throw new Error("it's a null");
return v;
};
const injectScript = (src) => {
const script = document.createElement('script');
script.src = src;
script.onload = function () {
this.remove();
};
try {
nullthrows(document.head || document.documentElement).appendChild(script);
} catch {}
};
injectScript(chrome.runtime.getURL('/block-script.js'));

BIN
images/BDB-ICON128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/BDB-ICON16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

BIN
images/BDB-ICON256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
images/BDB-ICON32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
images/BDB-ICON48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
images/BDB-ICON512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

42
manifest.json Normal file
View File

@ -0,0 +1,42 @@
{
"manifest_version": 3,
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"default_locale": "en",
"version": "1.0.0",
"version_name": "1.0.0",
"permissions": [],
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": ["content-script.js"],
"run_at": "document_start"
}
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/BDB-ICON16.png",
"32": "images/BDB-ICON32.png",
"48": "images/BDB-ICON48.png",
"128": "images/BDB-ICON128.png"
}
},
"web_accessible_resources": [
{
"resources": [ "block-script.js" ],
"matches": [ "https://*/*" ]
}
],
"icons": {
"16": "images/BDB-ICON16.png",
"32": "images/BDB-ICON32.png",
"48": "images/BDB-ICON48.png",
"128": "images/BDB-ICON128.png",
"256": "images/BDB-ICON256.png",
"512": "images/BDB-ICON512.png"
}
}

1
package.json Normal file
View File

@ -0,0 +1 @@
{}

135
popup.html Normal file
View File

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html>
<head>
<style>
button {
outline: none;
}
* {
box-sizing: border-box;
}
*:focus {
outline: none;
}
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: 'Roboto', sans-serif;
width: 28em;
background: #121116;
background-image: radial-gradient(top, circle cover, #232327 0%, #151516 80%);
color: ghostwhite;
}
.mainbody {
text-align: center;
}
.pre-inline {
display: inline;
}
/* // TABS */
.container--tabs {
margin: 1rem 0rem 1rem 0rem;
}
.container--tabs .nav-tabs {
display: flex;
width: 100%;
margin: 0;
list-style-type: none;
border-bottom: 0.2rem solid #ff9800
}
.container--tabs .nav-tabs > li {
margin-bottom: 0.1rem;
}
.container--tabs .nav-tabs > li > a {
margin-right: 0.4rem;
line-height: 1.42857143;
padding: 0.52em;
border: 0.2rem solid transparent;
border-radius: 4px 4px 0 0;
color: rgb(204, 185, 13);
}
.container--tabs .nav-tabs > li > a:hover {
border-color: rgb(255, 208, 53) rgb(132, 182, 40) rgba(185, 95, 21, 0.432) rgb(172, 199, 53);
}
.container--tabs .nav-tabs > li.active > a,
.container--tabs .nav-tabs > li.active > a:hover,
.container--tabs .nav-tabs > li.active > a:focus {
color: #f44336;
cursor: default;
background-color: #0000007a;
border: 0.2rem solid #dd9003;
border-bottom-color: transparent;
}
.container--tabs .tab-content {
float: left;
width: 100%;
}
.container--tabs .tab-content > .tab-pane {
display: none;
}
.container--tabs .tab-content > .tab-pane.active {
display: block;
padding: 1.5% 1.5%;
}
.container--tabs .tab-content > .active {
display: block;
}
</style>
</head>
<body>
<div class="mainbody" style="min-width: 100%">
<div class="container--tabs">
<section class="row">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-1">Main</a></li>
<li class=""><a href="#tab-2">Notes</a></li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane active">
<h3 style="font-size: 1.1rem; text-transform: uppercase;">Brave Detection Block</h3>
<img id="logo" src="" alt="BDB LOGO" >
<h3>While the extension is enabled:</h3>
<h3><pre>window.navigator.brave</pre></h3>
<h3>can't be accessed by any website</h3>
</div>
<div id="tab-2" class="tab-pane" style="font-size: 0.9rem; text-align: left">
<h3 style="font-size: 1.1rem; text-transform: uppercase;">Notes</h3>
This extension is used to block detection of brave browser by websites.
<br /><br />
It only blocks the official detection which is checking the <pre class="pre-inline">window.navigator.brave object</pre>.
<br /><br />
The extension does not touch the <pre class="pre-inline">user-agent</pre> or try to prevent other methods of detecting brave browser.
<br /><br />
For that reason to employ a higher degree of privacy is recomanded to use an <preclass="pre-inline">user-agent randomizer extension,</pre>
set the fingerpint blocking to max in brave settings, and also allow this extension and
the user-agent randomizer extension to work in incognito mode.
<br /><br />
If you want even more privacy than that use a no logs VPN doubled by a brave tor window.
<br /><br />
If you're even more privacy focused you could set up a private VPN on a VPS bought with a privacy crypto and only,
use DOH for DNS doubled by TOR using only hidden services no exist nodes on a non-persistent OS decrypted at boot time
from a scrambled hidden partition.
<br /><br />
(Don't know why you would employ such effort but I'm just trying to be techincal.)
<br /><br />
<h3>Check source at:</h3>
<a href="https://https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension">
https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension
</a>
</div>
</div>
</section>
</div>
</div>
<script src="popup.js"></script>
</body>
</html>

143
popup.js Normal file
View File

@ -0,0 +1,143 @@
'use strict';
window.addEventListener(
'message',
(event) => {
if (event.data.action === 'proxyError') {
displayAlert('error', 'Wrong data, or proxy down double check the input.');
}
},
false,
);
// let btn_close_alert = document.getElementById('closeAlertBtn');
// const btnProxyStop = document.getElementById('btnProxyStop');
// const btnProxyStart = document.getElementById('btnProxyStart');
// const proxyTypeGroup = document.getElementById('proxyTypeGroup');
// const btnProxyType = [
// document.getElementById('btnProxyTypeHttp'),
// document.getElementById('btnProxyTypeHttps'),
// document.getElementById('btnProxyTypeSocks4'),
// document.getElementById('btnProxyTypeSocks5'),
// ];
// for (const btn of btnProxyType) {
// if (btn) {
// btn.onclick = async function () {
// const active = proxyTypeGroup.querySelector('.btn-green');
// if (active) {
// active.classList.remove('btn-green');
// }
// this.classList.add('btn-green');
// bgP.window.extOptions.activeProxy.type = this.id.replace('btnProxyType', '').toLowerCase();
// await bgP.window.setOptions(bgP.window.extOptions);
// };
// }
// }
// const spanProxyStatusOn = document.getElementById('spanProxyStatusOn');
// const spanProxyStatusOff = document.getElementById('spanProxyStatusOff');
// const inputproxyHost = document.getElementById('proxyHost');
// const inputproxyPort = document.getElementById('proxyPort');
// const updatePopup = function (options) {
// if (options.proxyEnabled) {
// spanProxyStatusOff.classList.add('hidden');
// spanProxyStatusOn.classList.remove('hidden');
// btnProxyStart.classList.add('hidden');
// btnProxyStop.classList.remove('hidden');
// } else {
// spanProxyStatusOn.classList.add('hidden');
// spanProxyStatusOff.classList.remove('hidden');
// btnProxyStart.classList.remove('hidden');
// btnProxyStop.classList.add('hidden');
// }
// if (options.activeProxy) {
// const types = ['http', 'https', 'socks4', 'socks5'];
// if (options.activeProxy.type) btnProxyType[types.indexOf(options.activeProxy.type)].classList.add('btn-green');
// inputproxyHost.value = options.activeProxy.host;
// inputproxyPort.value = options.activeProxy.port;
// }
// };
// updatePopup(bgP.window.extOptions);
// btnProxyStop.onclick = function () {
// bgP.window.extOptions.proxyEnabled = false;
// bgP.window.setOptions(bgP.window.extOptions);
// bgP.window.disableProxy();
// updatePopup(bgP.window.extOptions);
// };
// btnProxyStart.onclick = function () {
// bgP.window.extOptions.activeProxy.host = inputproxyHost.value;
// bgP.window.extOptions.activeProxy.port = inputproxyPort.value;
// bgP.window.extOptions.proxyEnabled = true;
// bgP.window.setOptions(bgP.window.extOptions);
// bgP.window.setProxy(bgP.window.extOptions.activeProxy);
// updatePopup(bgP.window.extOptions);
// };
// let displayAlert = (type, msg) => {
// if (type === 'error') {
// document.getElementById('exAlertBox').classList.remove('alert-success');
// document.getElementById('exAlertBox').classList.add('alert-warning');
// } else if (type === 'success') {
// document.getElementById('exAlertBox').classList.remove('alert-warning');
// document.getElementById('exAlertBox').classList.add('alert-success');
// }
// document.getElementById('alertMsg').innerHTML = msg;
// document.getElementById('exAlert').classList.remove('hidden');
// };
// let closeAlert = () => {
// const alert = document.getElementById('exAlert');
// if (alert) {
// document.getElementById('exAlert').classList.add('hidden');
// }
// };
// closeAlert();
// btn_close_alert.addEventListener('click', function () {
// closeAlert();
// });
const myTabs = document.querySelectorAll('ul.nav-tabs > li');
function myTabClicks(tabClickEvent) {
for (let i = 0; i < myTabs.length; i++) {
myTabs[i].classList.remove('active');
}
const clickedTab = tabClickEvent.currentTarget;
clickedTab.classList.add('active');
tabClickEvent.preventDefault();
const myContentPanes = document.querySelectorAll('.tab-pane');
for (let i = 0; i < myContentPanes.length; i++) {
myContentPanes[i].classList.remove('active');
}
const anchorReference = tabClickEvent.target;
const activePaneId = anchorReference.getAttribute('href');
const activePane = document.querySelector(activePaneId);
activePane.classList.add('active');
}
for (let i = 0; i < myTabs.length; i++) {
myTabs[i].addEventListener('click', myTabClicks);
}
const imgURL = chrome.runtime.getURL("images/BDB-ICON256.png");
document.getElementById("logo").src = imgURL;