Keyboard events simulation

75 Views Asked by At

Hey I am interested in learning web development and hacking into sites to see how they implement their security mechanisms. I stumbled upon a ticketing website that has a login, I am trying to log in using JavaScript code that will enter the input value of the email and password.

Here's an example of the login page: Ticketmaster

When I try to modify the input values using this code it seems to be not working By not working I mean when you click sign in it'll empty the fields.:

document.querySelector("[name=email]").value = "[email protected]"
document.querySelector("[name=password]").value = "password123A@"

I try to do that in the console (by pressing F12). I even went crazy and dispatched all the different types of events. They seem to identify somehow that my events are driven by code. I am curious of how they implemented such methodology and how can I implement in my website.

example for dispatching an event on input to simulate user changing input.

document.querySelector("[name=email]").dispatchEvent(new Event("change"))

When changing the value you'll see that the value is changed but once you try to focus/blur from the input element, the value will just disappear...

2

There are 2 best solutions below

1
fuziion_dev On

I've just tried it and it works perfectly fine on the example website.

My attempt of your code using Google Chrome console.

3
Derek On

If I was to implement such security integrity, I'd probably try checking that the input came from keyboard keypress only.