Javascript for Pentester Task 6

Hello internet people today I am going to post another solution to the task provided at Javascript for Pentester at Pentester Academy. This task is different in which we will learn how to play with event listeners in Javascript. You can view solutions to the other tasks here.

Task 6: Capture All Clicks | Task Link

The task is to capture all clicks and redirect it to an attacker-controlled site. Practically we don’t have to go and capture all the clicks, we just have to redirect the user whenever if he clicks anywhere on the page. And this can be done with Event Listener in Javascript.
Solution:
The solution is just a code of few lines. First, we will create event listener which will do the task of redirecting when the victim clicks anywhere on the page by triggering redirect function that we create after that.

<script>
document.body.addEventListener('click', redirect);
function redirect(){
window.location.href = 'http://PentesterAcademy.com'
}
</script>

Now copy and URL-encode the code provided above and paste it after the same “url” parameter as we did in last few tasks.
That’s all. Refer this post as a quick solution for the Javascript for Pentester tasks. For an in-depth video tutorial, please refer to the video solutions provided at Pentester Academy website.

Leave a Comment

Your email address will not be published. Required fields are marked *

This Festive Season Get Up To 30% OFF🎉🎉

X
Send us Query
close slider