Javascript Injection help...

Javascript Injection help...

Post by guitarist10 on Wed Dec 28, 2011 7:00 am
([msg=63442]see Javascript Injection help...[/msg])

...Okay, I understand that this is totally unrelated to any of the missions. Of course, I'm sure they require injections and such, but I haven't done any of them yet, so just to clear this up, THIS IS NOT ABOUT THE JAVASCRIPT MISSIONS.

What I'm trying to do is have fun with Google and javascript injections. Changing what the "Google Search" and "I'm Feeling Lucky" buttons say, to be exact.

I've figured out that the "Google Search" button is form 0. This lead me to the assumption that the other one is form 1. Either it's not form 1, or I didn't find the right name for it in the source code. From what I've found, the name SHOULD be btnI. Right? If that's correct, then what is the correct form?
guitarist10
New User
New User
 
Posts: 5
Joined: Wed Dec 21, 2011 9:48 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by LoGiCaL__ on Wed Dec 28, 2011 9:53 am
([msg=63446]see Re: Javascript Injection help...[/msg])

guitarist10 wrote:...Okay, I understand that this is totally unrelated to any of the missions. Of course, I'm sure they require injections and such, but I haven't done any of them yet, so just to clear this up, THIS IS NOT ABOUT THE JAVASCRIPT MISSIONS.

What I'm trying to do is have fun with Google and javascript injections. Changing what the "Google Search" and "I'm Feeling Lucky" buttons say, to be exact.

I've figured out that the "Google Search" button is form 0. This lead me to the assumption that the other one is form 1. Either it's not form 1, or I didn't find the right name for it in the source code. From what I've found, the name SHOULD be btnI. Right? If that's correct, then what is the correct form?


Try using the form id instead of an index.
For instance:
Code: Select all
javascript:alert(document.forms['form id'].btnI.value="test")


I tested it and it worked with the form id. Also, I moved this topic into web design since it doesn't concern any particular mission.
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1060
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by guitarist10 on Wed Dec 28, 2011 4:47 pm
([msg=63451]see Re: Javascript Injection help...[/msg])

Thanks for moving this to the correct forum. I honestly had no clue where to put this.

Anyways, with that information, I have a new question; Where do I find the form ID in the source code? I simply can't find anything along those lines.
guitarist10
New User
New User
 
Posts: 5
Joined: Wed Dec 21, 2011 9:48 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by LoGiCaL__ on Wed Dec 28, 2011 5:43 pm
([msg=63452]see Re: Javascript Injection help...[/msg])

guitarist10 wrote:Thanks for moving this to the correct forum. I honestly had no clue where to put this.

Anyways, with that information, I have a new question; Where do I find the form ID in the source code? I simply can't find anything along those lines.


While you have the source page open, press ctrl + f to open the find function and search for the form tag. If you aren't sure which one is the id, then google the form tag.
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1060
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by guitarist10 on Wed Dec 28, 2011 8:04 pm
([msg=63453]see Re: Javascript Injection help...[/msg])

So, for some reason, I used this code...

Code: Select all
javascript:void(document.forms[0].btnI.value="test")


...and without changing the number in the brackets, just changing the name, I got it. Is there anyone who can explain this to me? I feel like it should be a different number, but it's not. It's confusing me. :p
guitarist10
New User
New User
 
Posts: 5
Joined: Wed Dec 21, 2011 9:48 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by LoGiCaL__ on Wed Dec 28, 2011 9:40 pm
([msg=63455]see Re: Javascript Injection help...[/msg])

There's only one pair of <form></form> tags with a couple inputs within the form tags. So when you referenced the first button it's still within the same form tag as the second button. Hence a different name for the the two inputs. Basically, <form></form> tags can have multiple inputs. Just because there are two buttons doesn't mean it has two forms.

Just out of curiosity, what made you think there were two forms if you didn't check for the tags before you tested for the second button?
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1060
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by guitarist10 on Thu Dec 29, 2011 12:08 am
([msg=63456]see Re: Javascript Injection help...[/msg])

I'm literally JUST learning this sort of thing, so I'm a little stupid with HTML code 'n such. That's why. Thanks for explaining it to me, though!
guitarist10
New User
New User
 
Posts: 5
Joined: Wed Dec 21, 2011 9:48 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by LoGiCaL__ on Thu Dec 29, 2011 3:08 am
([msg=63457]see Re: Javascript Injection help...[/msg])

guitarist10 wrote:I'm literally JUST learning this sort of thing, so I'm a little stupid with HTML code 'n such. That's why. Thanks for explaining it to me, though!


Ah, don't be like that man. I honestly just thought you knew something I was missing. A good portion of the code is obfuscated or at least it is to me. Stick around, and at least now you have a good starting point.
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1060
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by guitarist10 on Thu Dec 29, 2011 5:06 pm
([msg=63462]see Re: Javascript Injection help...[/msg])

I plan on sticking around on this site. :) I'm having a lot of fun learning this stuff and the hacking missions are VERY fun. Not to mention challenging.
guitarist10
New User
New User
 
Posts: 5
Joined: Wed Dec 21, 2011 9:48 pm
Blog: View Blog (0)


Re: Javascript Injection help...

Post by mShred on Mon Jan 02, 2012 11:20 pm
([msg=63487]see Re: Javascript Injection help...[/msg])

guitarist10 wrote:I plan on sticking around on this site. :) I'm having a lot of fun learning this stuff and the hacking missions are VERY fun. Not to mention challenging.

This is something I like to hear.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1707
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)


Next

Return to Web Design

Who is online

Users browsing this forum: No registered users and 0 guests