如何从域名列表中过滤 CDN 服务的域?

How can I filter the domains served by a CDN from a list of domain names?

我有一个域列表,我需要过滤由 CDN(内容分发网络)提供服务的域。我将使用 python 脚本来做到这一点。 起初我以为我可以从域名中识别它们。但并不是所有的域名都有cdn关键字。

我使用 CDN 服务域来识别 CDN 服务域是否有任何原因或特征?

首先,你不可能做到 100% 准确。

但在许多情况下,您可以通过跟踪 CNAME 记录来识别使用流行云提供商的域,这些记录将引导相应提供商的服务器。 IE。这是 Amazon CloudFront 上的文档 http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

In CloudFront, an alternate domain name, also known as a CNAME, lets you use your own domain name (for example, www.example.com) for links to your objects instead of using the domain name that CloudFront assigns to your distribution

示例:

dig -t CNAME c.amazon-adsystem.com
c.amazon-adsystem.com.  896     IN      CNAME   d1ykf07e75w7ss.cloudfront.net.