From c9d7254c4d913e1c592cda6419d19479abcd3788 Mon Sep 17 00:00:00 2001 From: z0ccc Date: Sat, 11 Sep 2021 12:42:29 -0400 Subject: [PATCH] Detect brave and tor browser --- frontend/src/components/OtherBlock.js | 14 ++------ frontend/src/components/ScanBlocks.js | 2 +- frontend/src/components/main.js | 52 ++++++++++++++------------- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/OtherBlock.js b/frontend/src/components/OtherBlock.js index b28a1c5..c7082c2 100644 --- a/frontend/src/components/OtherBlock.js +++ b/frontend/src/components/OtherBlock.js @@ -7,7 +7,7 @@ import { checkNavigatorProperties, checkWebWorker, checkScreenProperties, - getUserAgentData, + getOther, } from './main'; const OtherBlock = () => { @@ -30,17 +30,7 @@ const OtherBlock = () => { return (

Other

- {userAgent && ( -
- {/* */} - {/*
- {getBrowser(userAgent.browser.name)} {userAgent.browser.version} -
*/} -
- {userAgent.os.name} {userAgent.os.versionName} -
- - )} +

Explanation: JavaScript can be used to find information about your hardware. This information can be used to create a fingerprint. diff --git a/frontend/src/components/ScanBlocks.js b/frontend/src/components/ScanBlocks.js index 4f45389..9d46739 100644 --- a/frontend/src/components/ScanBlocks.js +++ b/frontend/src/components/ScanBlocks.js @@ -13,8 +13,8 @@ import FiltersBlock from './FiltersBlock'; const ScanBlocks = () => ( <> - + diff --git a/frontend/src/components/main.js b/frontend/src/components/main.js index bc8b584..8a098f1 100644 --- a/frontend/src/components/main.js +++ b/frontend/src/components/main.js @@ -8,8 +8,7 @@ export { checkWebWorker, getScreen, checkScreenProperties, - getBrowser, - getUserAgentData, + getOther, }; const getDeviceMemory = () => ({ @@ -279,25 +278,35 @@ const getScreen = () => [ getColorDepth(), ]; -const getUserAgentData = (userAgent) => { - // getBrowser(); - console.log(userAgent); -}; - -// const getBrowser = (userAgent) => { -// if (navigator.brave) { -// return 'Brave'; -// } -// return userAgent; -// }; - -const getBrowser = () => ({ - key: 'Browser', - title: 'Color depth', - value: window.screen.colorDepth, +const getBrave = () => ({ + key: 'brave', + title: 'Brave browser', + value: navigator.brave ? 'True' : 'False', issues: [], }); +const detectTor = () => { + const date = new Date(); + if ( + navigator.plugins.length === 0 && + date.getTimezoneOffset() === 0 && + window.outerWidth === window.screen.availWidth && + window.outerHeight === window.screen.availHeight + ) { + return true; + } + return false; +}; + +const getTor = () => ({ + key: 'tor', + title: 'Tor browser', + value: detectTor() ? 'True' : 'False', + issues: [], +}); + +const getOther = () => [getBrave(), getTor()]; + // sorts plugins object into comma separated list const sortPlugins = (data) => { const { length } = data; @@ -396,10 +405,3 @@ const checkWebWorker = (key, setWorkerData) => { } }; }; - -// const getBrowser = (userAgent) => { -// if (navigator.brave) { -// return 'Brave'; -// } -// return userAgent; -// };