Welcome to this lecture.
Now we have already studies some of the topics in the java script like creating a variable fund since
lube and conditionals.
Now it's time to see the events.
So what is their STEM relevance.
SOON DISCOVER IT stem elephants how it work with javascript code and everything about this to AML and
JavaScript events in this lecture so you would wonder why we need to understand the events in the hacking
so that is because we can attack DOD's barometers like unclean.
On a list not and everything that is related to events.
So in this hack are we just correct that even barometer to run our payload.
So in this understand these events what are the type of the events and how it works with the device
keep in the selector.
So let's get it started.
So first of all who are these the events.
So let me this open the sublime text so you could see here the plain yes day email document.
So here we have just studied about this terminal that is tag over here and closing this temple tag body
and inside this body we have the button tag.
So what this button that does is it and this create a simple button in your is dismal documents.
So when you just run these files.
So let me just go quickly to my folder.
And let me just run this file which is index file so it is indexed dot estimate.
Then you could see this in the same file over here which is saying two days time it so you could see
it is the Barton in the same document.
But when you just press this button nothing is happening because we are not assigning the events to
these system elements.
So this is your particular SDM all elements and we make use of a javascript code to assign some events
to these systemic elements.
So let's get it started.
So first of all when the javascript easy used in the estimate pages JavaScript can react on these estimable
elements by the use of a javascript code.
So the stimulus elements are this dismal events can be something that the browser does or something
a user does so that can be the operation of the browser or that can be the operation of the user other
client.
So we'll see some of the example now here with the case of these dismal events.
So first of all what we do is in just go back to our Sublime Text over here and you can see we have
two days time is which is the button.
So let's assign some event to this button.
So I just assigned a simple unclear given.
We have bundles of the events in the zombie script but we'll just assign unclear Kobo here and I'll
just say document which is referring to this particular document of the estimate.
And I'll just get the element.
So I'll just say document get element by I.D. not the tag name.
So let me just remove this and it should be I.D. and a list sig for.
Let me say demo.
And this is your honor.
Click.
So now what you can do simply is you can just insert that is another parameter to this demo.
So let me just go over here.
Put the period and others say inner estimate which is referring to the content of Estimate and gnome.
Let me make use of these inbuilt method of java script which is dead method.
So let's go in our console quickly and let me show you what this did does.
So if I just sit on my console in the browser and if I call this a dead method and heat into it will
see their dead over here which is giving us in the string format which is the data which is my current
location data over here and you could see it is returning the date of today over here and this is your
simple that is done by script method that will return the date.
So what we are going to do in here is when the user press this button which is suing us simply let me
show you.
That is two days time is so when the user presses this button it will be redirected to call this dead
method and it will just insert to this date to something.
So let us make that paragraph.
Now we will have the I.D. demo.
So let me just quickly create that paragraph so I'll the say that I.D. be demo because we want to this
insert this date to this paragraph.
Let me just close this paragraph.
No so let me show you what is happening over here.
So we are just saying we have a paragraph over here so we are giving the paragraph demo but this doesn't
contain any content.
If you want you can just put over here.
This is paragraph or something.
And the is a sport here.
That is a paragraph.
And when you see here that is the demo idea what it is going to do is it will change it.
This element.
So if you just see this paragraph is also yes stable element and we are just saying here when the user
presses this button which is basically on click event and we are just saying that when user presses
this button we want to send the demo which is basically the I.D. which is the paragraph into today's
date.
So let me just say this quickly and run this again.
So let me just go back here and you can see we have now.
This is paragraph over here which is the same document.
Let me just quickly saw you.
So this is the same paragraph having the idea demo which is over here now in it just suppress this two
days time is see what it is going to happen.
In sense this content of this is paragraph to two days.
So you could see we have the today's date or the time which is the current time over here instead of
this is paragraph which was the initial content of the paragraph.
So this is the event.
So we make use of this unclear event which is basically when the user presses that event we're going
to do something with that estimable elements.
You can also make a use of on mouse over here.
So the C on mouse over which is another event and it is saying when the user move the mouse over to
this feel it sends to the Guardian into it.
So let me just sort of trace again.
So now the see my pointer over here the mouse pointer and when I just hover this mouse pointer it this
button which is today's time is button you will see that it had ends.
Now to cut in did so this time it is not the moon that it's own click event it is now on mouse sober.
We have the aunt in Ziv and we have on mouse over on mouse out on key down unload.
So when you say on key down and means write your own key down which is that not even let me save this
town and we just remove this and the phrase this page again.
And now we are just making that is on key down.
So when I just press the keyboard key then you could see that this is paragraph will be genes to something
that is today's date so you can just enter or you can just press those space key or enter just moving
that mouse over here and press the CFD or basically any key that would be space.
So if I just press this down then you could see that this content has been tends to the current debt
because in this case we have on key down even.
So this will be some of the events and we'll see how we can create the payload so as to crack or basically
get the vulnerabilities on these particular parameter in the upcoming lecture and you can simply grab
this from the resource section that is the sum of the events over here which is on sense and this is
going to this big call or even book when the stimulus elements has been sent.
So if you see something will be changes in the estimate documents this matter will be triggered and
when the user click on their stimulations which was when we would just press the button on click event
will be this card and when the user move the mouse over their stable mates or hover the mouse over the
stable elements on mouse over method really big girl.
And when the user moved the mouse away from the stimulus elements on mouse out will be called.
So let's take example of this on mouse out.
So let's say on mouse out and when I just save this town go back to our model over here and let me just
sort of phrase this again.
And when I just move my mouse out of here you could see that this has been tense to the current date
again.
So this is another event and you have on key down when the user presses a keyboard key.
This method will be in book.
And when the browser has finished loading the pace on load material will be called and we'll see how
to this hack.
All of these events so as to make a simple payload and get the accesses attack on that Web site in the
upcoming lecture for now I'll see you.
Good.
See you in the next lecture.