C
C
Cat Anton2015-10-01 16:44:23
JavaScript
Cat Anton, 2015-10-01 16:44:23

How does Avito block the developer console in the Chrome browser?

I got into Avito's code here through the Chrome console, and was surprised to find this code that launches something like an endless debugging mode, i.e. HTML / JavaScript code is protected from being studied:

(function(x){
    (function(f){
        (function a(){
            try {
                function b(i) 
                {
                    if ((''+(i/i)).length !== 1 || i % 20 === 0) {
                        (function(){}).constructor('debugger')();
                    } else {
                        debugger;
                    }
                    b(++i);
                }
                b(0);
            } catch(e) {
                f.setTimeout(a, x)
            }
        })()
    })(document.body.appendChild(document.createElement('frame')).contentWindow);
})

59635005326742e7837387f3a5a60001.png
Please explain how this "magic" works and how it can be bypassed?
Articles describing this method could not be found, I will be glad if you throw it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
littleguga, 2015-10-01
@27cm

It can be easier.
Click: deactivate breakpoints

spoiler
c5c4a8ef526b4d75b48d73718b223aaa.jpg

A
Andrey Shevchuk, 2015-11-16
@IIIEB4YK

Here is the content of the file that does this: https://gist.github.com/shvchk/69ecde1a5dcb32513814
Now it has the address https://www.avito.st/s/cc/978f54a4a62b76ad3e84bd5c...
You can just add it to Adblock/uBlock /etc simple rule to block it:

https://www.avito.st/s/cc/978f54a4a62b76ad3e84bd5cfad5652d3d907d4e*

(if the address changes, the contents of the script are posted above - look for it among the scripts used).

D
Dmitry Novikov, 2015-10-01
@dmitriy_novikov

Try it in firebug - there is a great "disable" button for the debugger.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question