Finding the domain name of a site that is hotlinking in Google app engine using 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:


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?


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: --email=whatever request_logs some_filename

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.

By : Unknown

This video can help you solving your question :)
By: admin