日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

浏览器指纹反爬虫

發(fā)布時(shí)間:2025/3/21 HTML 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 浏览器指纹反爬虫 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

瀏覽器指紋反爬蟲

在現(xiàn)行的網(wǎng)絡(luò)爬蟲檢測(cè)技術(shù)中,主要有以下兩大類:

  • 行為檢測(cè)
  • 指紋識(shí)別

行為檢測(cè)是通過分析網(wǎng)頁上用戶的操作(鼠標(biāo)的移動(dòng)、點(diǎn)擊、滾動(dòng)行為和瀏覽行為)來判斷操作者是否是機(jī)器控制的網(wǎng)絡(luò)爬蟲。

而指紋識(shí)別則是通過分析設(shè)備和瀏覽器的信息來判斷訪問者是否為網(wǎng)絡(luò)爬蟲。


除了 navigator,還有一些其它的標(biāo)志性字符串(不同的瀏覽器可能會(huì)有所不同),常見的特征串如下所示:

webdriver __driver_evaluate __webdriver_evaluate __selenium_evaluate __fxdriver_evaluate __webdriver_unwrapped __selenium_unwrapped __fxdriver_unwrapped _Selenium_IDE_Recorder _selenium calledSelenium _WEBDRIVER_ELEM_CACHE ChromeDriverw driver-evaluate webdriver-evaluate selenium-evaluate webdriverCommand webdriver-evaluate-response __webdriverFunc __webdriver_script_fn __$webdriverAsyncExecutor __lastWatirAlert __lastWatirConfirm __lastWatirPrompt $chrome_asyncScriptInfo $cdc_asdjflasutopfhvcZLmcfl_

反指紋識(shí)別方法

  • webdriver 配置
options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["enable-automation"]) browser = webdriver.Chrome(chrome_options=options) driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source": """Object.defineProperty(navigator, 'webdriver', {get: () => undefined})""",})

mitmproxy 篡改參數(shù)

# coding: utf-8# modify_response.py from mitmproxy import ctxdef response(flow):"""Modify response data"""if '/js/yoda.' in flow.request.url:# Screening selenium detectionfor webdriver_key in ['webdriver', '__driver_evaluate', '__webdriver_evaluate', '__selenium_evaluate','__fxdriver_evaluate', '__driver_unwrapped', '__webdriver_unwrapped','__selenium_unwrapped', '__fxdriver_unwrapped', '_Selenium_IDE_Recorder', '_selenium','calledSelenium', '_WEBDRIVER_ELEM_CACHE', 'ChromeDriverw', 'driver-evaluate','webdriver-evaluate', 'selenium-evaluate', 'webdriverCommand','webdriver-evaluate-response', '__webdriverFunc', '__webdriver_script_fn','__$webdriverAsyncExecutor', '__lastWatirAlert', '__lastWatirConfirm','__lastWatirPrompt', '$chrome_asyncScriptInfo', '$cdc_asdjflasutopfhvcZLmcfl_']:ctx.log.info('Remove "{}" from {}.'.format(webdriver_key, flow.request.url))flow.response.text = flow.response.text.replace('"{}"'.format(webdriver_key), '"NO-SUCH-ATTR"')print(webdriver_key)flow.response.text = flow.response.text.replace('t.webdriver', 'false')flow.response.text = flow.response.text.replace('ChromeDriver', '')mitmdump.exe -p Port number -s modify_response.py

總結(jié)

以上是生活随笔為你收集整理的浏览器指纹反爬虫的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。