使用 web2py 查找在 Google 应用引擎中热链接的网站的域名

发布于 2024-07-30 18:54:34 字数 391 浏览 4 评论 0原文

假设我们在 Google App Engine 中有一张图片,并且网站正在热链接它。 如何找到网站的域名?

我的第一个想法是:

请求客户端

,然后进行反向查找,但这在 GAE 中是不可能的,并且会花费很多时间。 我非常确定有一个属性可以让我获取请求该文件的站点的 url (在请求的某个地方?)。 GAE 有一个请求类,但我不能让它在 web2py 中工作。

有任何想法吗?

Let's say we have an image in the Google App Engine and sites are hotlinking it.
How can I find the domain names of the sites?

My first thought was:

request.client

and then do a reverse lookup but that it's not possible in GAE and would take a lot of time.
I am pretty sure that there is a property that allows me to get the url of the site that is requesting the file
(somewhere in request?). GAE has a Request class but I couldn't make it work inside web2py.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷心人i 2024-08-06 18:54:36

如果您只是想找出域名(不是在请求图像 URL 时通过运行脚本来阻止请求),那么它们将出现在请求日志中。 在管理界面中,转到“日志”,从下拉列表中选择“仅请求”。 如果展开“选项”,您可以过滤相关文件名。

然后展开每个请求日志条目,引用者可以是连字符,也可以是紧随 200(或其他)状态代码和传输大小的引号中的字符串。 很有可能并非所有客户端都阻止或欺骗标头,因此您将看到链接的 URL。

您还可以使用 SDK 下载日​​志,并在本地搜索/处理它们:

appcfg.py --email=whatever request_logs some_filename

If you're just looking to find out the domain names (not to block the requests by running a script when the image URL is requested), then they'll be in the request logs. In the admin thingy go to "Logs", select "Requests only" from the drop-down. If you expand "Options" you can filter on the relevant filename.

Then expand each request log entry, and the referer is either a hyphen, or the string in quotes immediately following the 200 (or whatever) status code and the size transferred. Chances are very high that not all of the clients have blocked or spoofed the header, so you'll see the URLs linked from.

You can also download the logs using the SDK, and search/process them locally:

appcfg.py --email=whatever request_logs some_filename
樱娆 2024-08-06 18:54:35

您可以轻松地从请求标头中获取引荐来源网址。 这个引荐来源网址可以被欺骗,但大多数人不会欺骗它,而且这个问题已经解决了。

除了手动解析之外,没有自动解析 DNS 的方法。 就像你说的,DNS 解析需要额外的时间,对于 Web2Py 或任何其他框架来说这样做是没有意义的。

You can easily get the referrer from the request headers. This referrer can be spoofed, but most people do not spoof it and it is already resolved.

There is no automatic way to resolve the DNS other than manually resolving it. Like you said, a DNS resolution takes extra time and it makes no sense for Web2Py or any other framework to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文