什么是用户代理解析器?
User-Agent 解析器读取浏览器发送的 User-Agent 请求头,并将其分解为浏览器名称和版本、渲染引擎、操作系统以及请求来自的设备类型。每个 HTTP 请求都携带这个字符串,它是服务器无需询问即可学习连接另一端内容的最常见方式。该头本身在 RFC 9110(HTTP 语义规范)中定义,其格式是历史上变得混乱的产品令牌和注释的非结构化列表。
That messiness is the reason a parser existing。a modern Chrome string still begin with "Mozilla/5.0" and still contains word "Safari", because browsers sporting each token to pass server sniffing tests。Edge carries "Chrome", Opera carries "Chrome", and Safari on a iPhone reports its real version in a separate "Version/" token rather than the "Safari/" one。reading a User-Agent by eye is therefore error-prone: the token that looks most simpled are offerly the reference in for head
该工具应用了这些怪癖所需的检测顺序。它首先测试嵌入另一个浏览器令牌的浏览器,因此 Edge 不会被误读为 Chrome,Chrome-on-iOS 字符串也不会被误读为 Safari。它将 Windows NT 内核编号映射到其营销名称,将下划线分隔的 iOS 和 macOS 版本转换回虚线形式,并将请求分类为桌面、移动设备、平板电脑或机器人。它还标记已知的爬虫和自动化签名,这是当您阅读 Web 服务器访问日志而不是调试单个浏览器时最有用的字段。
1个工作示例显示用户代理字符串解析器返回的内容在Windows样本上单击Edge,解析结果列出了Microsoft Edge 126.0。0.0、Blink 537.36、Windows 10/11、桌面、x86-64(64位)和Bot/爬虫没有,即使该字符串还包含Chrome和Safari令牌现在粘贴Googlebot智能手机字符串,该字符串在Android 6.0。1上声称Chrome:用户代理解析器仍然读取浏览器和操作系统,但设备类型变成了Bot/爬虫,机器人标志上写着是。当爬虫在日志中借用手机浏览器的身份时,您想要的就是这种分裂。
Everything都在你的浏览器中运行,你粘贴的字符串永远不会上传,这很重要,因为来自你自己流量的真实User-Agent可以暗示确切的设备,并构建访问者正在使用,没有注册,解析没有网络请求;只有复制按钮记录使用次数,没有字符串,你可以粘贴生产日志行,而无需将它们发送到任何地方。
如何使用用户代理解析器
粘贴用户代理字符串
UA 字符串从您的访问日志、浏览器控制台(navigator。userAgent)或请求标头中掉入。或加载其中一个内置样本。
读取解析的字段
浏览器、引擎、操作系统、设备类型、CPU架构和机器人标志都会随着您的键入立即检测到。没有按钮可以按下。
检查设备分类
查看请求是否来自桌面、手机、平板电脑或 Googlebot 等爬虫,以及字符串暴露的设备模型。
复制结果
将解析的表格复制为选项卡分隔的文本,粘贴到电子表格、错误报告或日志分析笔记中。
用户代理解析器功能
正确的检测顺序
Chrome 之前测试 Edge、Opera 和三星,并从其版本/令牌中读取 Safari,因此嵌入式兼容性令牌不会导致读错。
操作系统映射
将 Windows NT 内核编号转换为名称,恢复虚线 iOS 和 macOS 版本,并识别 Android、Chrome 操作系统和 Linux。
设备分类
将每个字符串标记为桌面、移动设备、平板电脑或机器人,并在用户代理包含 Android 或 Apple 设备模型时将其表面化。
Bot 和爬虫标志
匹配广泛的搜索引擎、社交和自动化签名,例如 Googlebot、Bingbot、curl 和无头 Chrome,用于日志分析。
Frequently Asked Questions
Related Tools
Basic Auth Generator
Turn a username and password into an HTTP Basic Authentication header, base64 token, curl commands and URL form, and decode existing Basic auth tokens back.
IP Subnet Calculator
Calculate the network address, broadcast, usable host range, subnet mask, and host count for any IPv4 address and CIDR prefix.
WHOIS Checker
Look up the registry record for any domain: registrar, registration and expiry dates, status codes, nameservers, DNSSEC and the raw WHOIS record.
WordPress Theme Detector
Find out which WordPress theme a site runs, with the version, the author, the parent theme and the evidence each answer came from.
Comments
0 comments
No comments yet. Be the first to share your thoughts!