我怎么能骗一个网站,着眼于JavaScript对象“导航仪”一看就知道我不是在Windows? [英] How can I fool a site that looks at the JavaScript object 'navigator' to see that I'm not on Windows?
问题描述
我想浏览一个网站,但是,因为他们只使用它的Windows和Mac下工作的 navigator.platform
从JavaScript找出我运行架构上。当然,他们也使用浏览器的用户代理,但是这很容易欺骗。
I am trying to browse a website, however, it only works under Windows and Mac because they use the navigator.platform
from JavaScript to find out the architecture I am running on. Of course, they also use the browser's user agent, but that was easy to spoof.
下面是有问题的.js文件: http://pastebin.com/f56fd608d 。在code负责检测浏览器是在顶部。是否有改变.js文件的任何方式对网站运行前,或类似的东西,这样我就可以消除支票?
Here is the .js in question: http://pastebin.com/f56fd608d. The code responsible for browser detection is at the top. Is there any way of changing the .js file before the site runs, or something similar, so I can eliminate the check?
使用JavaScript控制台收益率:
Using the JavaScript console yields:
> navigator.platform
结果的Linux的i686
显然,我改变了浏览器的用户代理,但 navigator.platform
似乎并没有把它从用户代理值。
Evidently I changed the browser's user agent, but navigator.platform
does not seem to take it's value from the user agent.
也许有人知道如何更改 navigator.platform
返回的值,因为我讨厌的VirtualBox下运行Windows使用这个网站。
Maybe someone knows how to change the value returned by navigator.platform
, because I hate running Windows under VirtualBox to use this site.
编辑:
这可能是有意义的,因为Linux的用户可能会被人为地拒绝访问的网站,并可以做什么了。
This could be of interest because Linux users might be artificially denied access to websites, and can do nothing about it.
推荐答案
既然你不能直接设置 navigator.platform
,你将不得不偷偷摸摸 - 创建一个行为像导航
对象,取代其平台
,然后设置导航
吧。
Since you can't directly set navigator.platform
, you will have to be sneaky - create an object that behaves like navigator
, replace its platform
, then set navigator
to it.
var fake_navigator = {};
for (var i in navigator) {
fake_navigator[i] = navigator[i];
}
fake_navigator.platform = 'MyOS';
navigator = fake_navigator;
如果您的文档加载(使用的GreaseMonkey,一个插件或者Chrome扩展),那么该页面会看到 navigator.platform
像以前一样执行此code MyOS
。
If you execute this code before the document loads (using GreaseMonkey, an addon or a Chrome extension), then the page will see navigator.platform
as "MyOS"
.
注:仅适用于Chrome测试
Note: tested only in Chrome.
这篇关于我怎么能骗一个网站,着眼于JavaScript对象“导航仪”一看就知道我不是在Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!