i am trying to basically replace a webpage's url with its ip address for example, instead of
www.facebook
i want to replace it with
66.220.153.11
Rationale
i have recently discovered that our school blocks websites based on a particular string patern in the url for example www.facebook is blocked but 66.220.153.11 is not yet they are the same thing.
so i want to learn how to do this using javascript(is this possible?) so i can develop a firefox addon to automatically change the url www.facebook to 66.220.153.11 and beat the censorship.
i am usually a c programmer but i know little javascript. Help me out. Thanks
i am trying to basically replace a webpage's url with its ip address for example, instead of
www.facebook.
i want to replace it with
66.220.153.11
Rationale
i have recently discovered that our school blocks websites based on a particular string patern in the url for example www.facebook. is blocked but 66.220.153.11 is not yet they are the same thing.
so i want to learn how to do this using javascript(is this possible?) so i can develop a firefox addon to automatically change the url www.facebook. to 66.220.153.11 and beat the censorship.
i am usually a c programmer but i know little javascript. Help me out. Thanks
-
2
+1 Interesting question, but
yet they are the same thing.
is incorrect: Only if the site is configured to show the site when entering the IP this will work. For the vast majority of sites, it won't. – Pekka Commented Oct 19, 2010 at 10:17 - 1 @pekka: For the vast majority of sites, it won't . Give us an illustrative example of a website where replacing the url with ip address wont work. Thanks – Dr Deo Commented Oct 19, 2010 at 10:23
- 2 I have one for you: Facebook :) Try to log in from the page you opened using the IP. Apart from that, every web site that runs on shared hosting is bound not to work (because multiple domains share one IP). However, all major sites do work, as a cursory check shows – Pekka Commented Oct 19, 2010 at 10:28
-
1
There are good security reasons why websites should not allow access to a browser that fails to supply the correct
Host:
header. See DNS rebinding and cross-subdomain cookie attacks. – bobince Commented Oct 19, 2010 at 10:42
3 Answers
Reset to default 3(Assuming accessing the site via the IP works)
I don't know in how detailed you expect an answer to be, but here is a general approach:
Changing the host
This is easy. Thelocation
object has an attributehostname
. If you have the IP address, you can just assign it tolocation.hostname
. On change, the site will reload (example - of course the target page does not exist).
In your plugin, you can attach an event handler for theload
event to thegBrowser
object. Read about Intercepting Page Loads.Getting the IP address
This is trickier. The only thing that es to my mind is to use some web service that does host name to IP resolution. So you would have to use Ajax with (probably) JSONP for this.
I hope this gives you a start.
This cant't work for the most domains in the world, because the IP points to a server, not to a domain. If there are hosted different domains on the same server(often hundreds of domains are hosted on one server), there is no way to point at the wanted domain without knowledge of the virtualhost-settings(which are usually not public).
You may take a look at this and see, how many domains can depend on a single IP:
http://www.robtex./ip/194.117.254.46.html
Also see, how many domains are hosted on the facebook-IP:
http://www.robtex./ip/66.220.153.11.html
Why don't you use a proxy to bypass the blocks?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745232942a4617761.html
评论列表(0条)