background
Before crawler, the website request needs to be combed first. F12 opens the developer mode of the browser is the first step, so the first trick of anti-crawler is to let the opponent’s browser enter the infinite loop debugger in developer mode.
Today continue baidu “with JS confusion encryption website how to crack”, see an article is going to refer to the test, the browser fell into an infinite cycle, after two steps, the website proudly announced that “the ans are for human services, you this machine retreat!” .
Okay, well, before you quit, you should know how you got beat. On the way to analyze the website of the family is how to reverse climb, when it is to steal the teacher to learn art!
Infinite debugger
I intend to follow a website to see the process of JS confusion, as a result of openingThis air quality monitoring platformEnter an infinite loop of anonymous functions:When you enter developer mode, you fall into the first “anonymous function” debugger infinite loop.
Click the Call Stack in the debug panel on the right to find the Call method:
Illegal debugging detects stack calls
The site detected illegal debugging and calledxsdefwsw()
To see the full view of the function, use the browser’s built-in formatting tools:There’s a timer in there and it’s calledtxsdefwsw()
Override this function on the browser console:
function txsdefwsw(a){};
Copy the code
After closing the right keyboard again, the prompt right button was disabled by the administrator, F12 was also disabled, the administrator of this website is really enough malicious. I started developer mode before I visited the website, so I haven’t noticed this yet.After the debugger continues twice, the following page is displayed:
Try overriding the function
Rewrite thesetTimeout
After the function,Here comes the hard partThe function overridden by the console has been cleared:It turns out theendebug(off,code)
The window function adds an immediate function that listens and clears the window function.
The revelation of
Summary of the site’s JS anti-crawler means, the first page is a pile of detection debugging code:
<script type="text/javascript">
var debugflag = false;
endebug(false, function () {
document.write('Illegal debugging detected, please close the debugging terminal, refresh this page and try again! ');
document.write("<br/>");
document.write("Welcome for People, Not Welcome for Machine!");
debugflag = true;
});
txsdefwsw();
document.onkeydown = function() {
if ((e.ctrlKey) && (e.keyCode == 83)) {
alert("Illegal debugging detected, CTRL + S disabled by administrator");
return false;
}
}
document.onkeydown = function() {
var e = window.event || arguments[0];
if (e.keyCode == 123) {
alert("Illegal debugging detected, F12 disabled by administrator");
return false;
}
}
document.oncontextmenu = function() {
alert('Illegal debugging detected, right click disabled by administrator');
return false;
}
$(function()
{
if(! debugflag && ! window.navigator.webdriver) { loadTab(); }if(! isSupportCanvas()) { $("#browertip").show(); }});function isSupportCanvas(a)
{
var elem = document.createElement('canvas');
return!!!!! (elem.getContext && elem.getContext('2d'));
}
</script>
Copy the code
Endebug also checks for console function overrides and clears the console. Txsdefwsw uses a timer to give the browser unlimited access to the debugger operation.
Well, disabling the right button, F12, and Debugger timer successfully dissuade the impromptu guy! I confess that I closed the site with a lot of respect for the developers of the site. I learned a lesson that made the trip worthwhile!