Hello World! is the easiest thing you can do. It doesn't effect a page, but it deffinatly gets you an understanding of how this is going to work. First of all, all Javascript Injections are preformed in the URL Bar (Address Bar). So go to any website you want, It doesn't really matter at all. Then, type in the URL Bar:
javascript:alert('Hello World!');
Now, let me explain what this does
javascript: This lets the browser you are using know that you are about to enter some sort of a Javascript command.
alert: This will make a little box pop up with the infor you wished to see. In our case. "Hello World"
('Hello World!'): This will be what is displayed in out alert box. Don't forget the quotes, otherwise it won't work properly.
;: As with almost every single Scripting/Programming language, you need to remember this at the end of almost every line of code. It won't work right without it.
If you did all that right, after you hit the enter button, you would have gotten a pop-up box displaying "Hello World".
Working With Cookies
This, can be a tiny bit more difficult to understand at first. And it still is for me, because I am sucky when it comes to Javascript. So I won't be the best at explaining every bit of this. But if you follow right, you should get it. Now, as before, go to any website you wish. For this tutorial, I will be using Tizag.com. Clear your address bar, and type:
Code:
javascript:alert(document.cookie);
(document.cookie) This will display the cookies that that website has set. Notice that there aren't any quotes around it? If there were, it would just display "document.cookie" in your little pop-up box, because it reads it as plain text.
Now lets add some cookies to a page. On that same webpage, view the cookies, using the previous method, and remember what they are, because we are going to add to that. Here is the script:
Code:
javascript:void(document.cookie = "Access = Granted");
void: This is just one of those things I am not to clear about. I would say what I think it is, but I don't want to make a fool of myself.
(document.cookie = "Access = Granted"): This gets into the cookies, and then adds the cookie saying that Access is granted. (Just an example, you could use anything.)
Alter Forms
Sometimes, to edit values sent to a given website through a form, you can download the html and edit it slightly to allow you to submit what you want. However, sometimes the website checks to see if you actually submitted it from the website you were supposed to. To get around this, we can just edit the form straight from javascript. Note: The changes are only temporary, so it's no tuse trying to deface a site through javascript injection like this.
Every form on a given webpage (unless named otherwise) is stored in the forms[x] array... where "x" is the number, in order from top to bottom, of all the forms in a page. Note that the forms start at 0, so the first form on the page would actually be 0, and the second would be 1 and so on. Here is a sample form which we will alter:
Code:
And now, here is the Javascript Injection we will use to alter the values of the form.
Code:
javascript:alert(document.forms[0].to.value)
Code:
javascript:void(document.forms[0].to.value="email@nhacks.com")
2 comments:
vab банк
vab банк
[url=http://globalist.org.ua/?p=19244]vab банк[/url]
http://globalist.org.ua/?p=19244 - vab банк
I wish I found www.blogger.com before ! Your site is very informative, thanks.
Post a Comment