Giter VIP home page Giter VIP logo

Comments (4)

abrahamjuliot avatar abrahamjuliot commented on June 5, 2024
  • worker canvas and hardwareConcurrency are distrusted in brave
  • 4359327 canvas tampering detect via nested iframe test
  • only the system is counted in worker userAgent (full userAgent with noise is counted in the loose fingerprint)

from creepjs.

abrahamjuliot avatar abrahamjuliot commented on June 5, 2024

EDIT: Fixed in desktop versions.

From #53, this catches hardwareConcurrency in 86 Stable. Issue is resolved in 87 Nightly

(function() {
    'use strict';
    const getNestedIframes = (n, context = window) => {
        n = +n
        let parent, total = n
        return (function getIframeWindow(win, {
            previous = context
        } = {}) {
            if (!win) {
                console.log('stopped at ', total - n) // Firefox has a limit
                return previous
            }
            const numberIframes = win.length
            const div = win.document.createElement('div')
            win.document.body.appendChild(div)
            div.innerHTML = '<iframe></iframe>'
            const iframeWindow = win[numberIframes]
            if (total == n) {
                parent = div
                parent.setAttribute('style', 'display:none')
            }
            n--
            if (!n) {
                parent.parentNode.removeChild(parent) //
                return iframeWindow
            }
            return getIframeWindow(iframeWindow, {
                previous: win
            })
        })(context)
    }

    const nestedWindow = getNestedIframes(20)
    console.log('top: ', window.navigator.hardwareConcurrency)
    console.log('nested: ', nestedWindow.navigator.hardwareConcurrency)
})()

from creepjs.

abrahamjuliot avatar abrahamjuliot commented on June 5, 2024
function getBraveMode() {
    try {
        // strict mode returns null supported extensions
        const canvas = document.createElement('canvas')
        const gl = canvas.getContext('webgl')
        if (!gl.getSupportedExtensions()) {
            return 'strict'
        }
        // standard and strict mode do not have chrome plugins
        const chromePlugins = /(Chrom(e|ium)|Microsoft Edge) PDF (Plugin|Viewer)/
        const pluginsList = [...navigator.plugins]
        const hasChromePlugins = pluginsList
            .filter(plugin => chromePlugins.test(plugin.name)).length == 2
        if (!hasChromePlugins) {
            return 'standard'
        }
        return 'allow'
    } catch (e) {
        return 'unknown'
    }
}
// if 'brave' in navigator...
getBraveMode()

from creepjs.

abrahamjuliot avatar abrahamjuliot commented on June 5, 2024
const detectBrave = async () => {
    const windowKeys = Object.keys(Object.getOwnPropertyDescriptors(window))
    const fileSystemKeys = /FileSystem((|Directory|File)Handle|WritableFileStream)|show((Directory|((Open|Save)File))Picker)/

    // each can be spoofed or blocked
    return {
        // moving to flags
        fileSystemAccessDisabled: !windowKeys.filter(key => fileSystemKeys.test(key)).length,
        webSerialDisabled: !('Serial' in window || 'SerialPort' in window),
        reportingDisabled: !('ReportingObserver' in window),
        // not strictly brave
        gpcInNavigator: 'globalPrivacyControl' in navigator,
        // primary method
        braveInNavigator: (
            'brave' in navigator &&
            Object.getPrototypeOf(navigator.brave).constructor.name == 'Brave' &&
            navigator.brave.isBrave.toString() == 'function isBrave() { [native code] }'
        ),
        // rule out other brands
        brandIsNotGoogleMicrosoftOrOpera: (
            !navigator.userAgentData ? 'unknown' :
            !navigator.userAgentData.brands
            .filter(item => /Google Chrome|Microsoft Edge|Opera/.test(item.brand)).length
        ),
        // blink w/2147483648 is brave (spoofable and blockable)
        storageQuotaIs2Gb: 2147483648 == (await navigator.storage.estimate()).quota,
    }
}

;(async () => {
    const x = await detectBrave()
    console.log(x)
})()

from creepjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.