Помочь забилдить хром webdriver на Ubuntu
1000 UAHНужно помочь забилдить хром вебдрайвер из источника в исполняемый файл на убунту. Источник от сюда https://github.com/bayandin/chromedriver забидлить свой по тому что https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver на крайняк можно забилдить у себя на машине и скинуть мне. Сейчас застрял на ошибке
gn: command not found
и не могу его как-то адекватно установить, а гугловские мануалы для меня слишком сложные почему-то
также нужно изменить некоторые джаваскрипт файлы, а также вставить один скрипт
Basically the way the selenium detection works, is that they test for pre-defined javascript variables which appear when running with selenium. The bot detection scripts usually look anything containing word "selenium" / "webdriver" in any of the variables (on window object), and also document variables called
$cdc_and$wdc_. Of course, all of this depends on which browser you are on. All the different browsers expose different things.For me, I used chrome, so, all that I had to do was to ensure that
$cdc_didn't exist anymore as document variable, and voila (download chromedriver source code, modify chromedriver and re-compile$cdc_under different name.)this is the function I modified in chromedriver:
call_function.js:
function getPageCache(opt_doc) { var doc = opt_doc || document; //var key = '$cdc_asdjflasutopfhvcZLmcfl_'; var key = 'randomblabla_'; if (!(key in doc)) doc[key] = new Cache(); return doc[key]; }(note the comment, all I did I turned
$cdc_torandomblabla_.Here is a pseudo-code which demonstrates some of the techniques that bot networks might use:
runBotDetection = function () { var documentDetectionKeys = [ "__webdriver_evaluate", "__selenium_evaluate", "__webdriver_script_function", "__webdriver_script_func", "__webdriver_script_fn", "__fxdriver_evaluate", "__driver_unwrapped", "__webdriver_unwrapped", "__driver_evaluate", "__selenium_unwrapped", "__fxdriver_unwrapped", ]; var windowDetectionKeys = [ "_phantom", "__nightmare", "_selenium", "callPhantom", "callSelenium", "_Selenium_IDE_Recorder", ]; for (const windowDetectionKey in windowDetectionKeys) { const windowDetectionKeyValue = windowDetectionKeys[windowDetectionKey]; if (window[windowDetectionKeyValue]) { return true; } }; for (const documentDetectionKey in documentDetectionKeys) { const documentDetectionKeyValue = documentDetectionKeys[documentDetectionKey]; if (window['document'][documentDetectionKeyValue]) { return true; } }; for (const documentKey in window['document']) { if (documentKey.match(/\$[a-z]dc_/) && window['document'][documentKey]['cache_']) { return true; } } if (window['external'] && window['external'].toString() && (window['external'].toString()['indexOf']('Sequentum') != -1)) return true; if (window['document']['documentElement']['getAttribute']('selenium')) return true; if (window['document']['documentElement']['getAttribute']('webdriver')) return true; if (window['document']['documentElement']['getAttribute']('driver')) return true; return false; };according to user
еще кстати нашел один сильный футпринт, и реализацию его устранения, понимаю как работает, но к сожалению не понимаю куда пихать. Если открыть консоль то в navigator будет поле webdriver:true не понимаю на каком этапе браузер это вставляет, но хочу от этого избавится тоже есть какой-то тул видимо использующий селениум и вот его issues связанные с этой проблемой https://github.com/citp/OpenWPM/pull/108/commits вот сам коммит с устранением этой проблемы https://github.com/citp/OpenWPM/pull/108/commits/d9ded62d3c3d005e3c3dacd9cb449c3ff7df36f2
szx, it is also possible to simply open chromedriver.exe in hex editor, and just do the replacement manually, without actually doing any compiling.
коммент к коммиту говорит что
The document attribute is removed with a DOMAttrModified eventListener
that removes itself after the first call. The navigator attribute is
prevented from being set by altering Object.defineProperty until
Selenium attempts to set the attribute (at which point the alteration is
reversed).
а вот и сам кодfunction getPageScript() { // return a string return "(" + function() { if ("webdriver" in navigator) { console.log("Webdriver attributes present, remove immediately"); // Attributes can be removed immediately document.documentElement.removeAttribute("webdriver"); delete window.navigator["webdriver"]; } else { // Listener for `document` attribute document.addEventListener("DOMAttrModified", function monitor(ev) { console.log("Removing webdriver attribute from document"); document.documentElement.removeAttribute("webdriver"); document.removeEventListener("DOMAttrModified", monitor, false); }, false); // Prevent webdriver attribute from getting set on navigator var originalDefineProperty = Object.defineProperty; Object.defineProperty(Object, 'defineProperty', { value: function(obj, prop, descriptor) { if (obj == window.navigator && prop == 'webdriver') { console.log("Preventing definition of webdriver property on navigator."); // Return Object.defineProperty to original state Object.defineProperty(Object, 'defineProperty', { value: originalDefineProperty }); delete originalDefineProperty;
-
добавил в описание, но ща еще напишу тут
-
Здравствуйте!
Данная проблема решилась?
Если да, то очень интересно как, тоже интересут решение.
Готов заплатить. -