Javascript for Pentester Task 2

Learning Javascript is very important for conducting manual testing on websites. Continuing to our solutions to the task provided at Javascript for Pentester I ma writing the solution to the second task. You can also see the solution to the first task here. The second task of Javascript for Pentester is also of an easy level. You can view solutions to the other tasks here.

Task 2: Change All Links | Task Link

In this task, we have to change all the links to the link provided( http://PentesterAcademy/topics). This has to done dynamically by changing the anchor tag data to custom links. This technique comes handy in client-side attacks with javascript.
Solution:
We will start with investigating the source code of the page. With that, we will find our target area, and that is the anchor tags. Grab the anchor tags and change its link to “http://PentesterAcademy/topics”.

<script>
for(var i=0;i<4;i++)
{
document.getElementsByTagName("a")[i].href = "http://PentesterAcademy/topics";
};
</script>

Copy this code and paste it into the input field on the target page and click enter, and done. In another way, URL encode the code and paste it after the url parameter. This script will run a for loop which iterates through all four anchor tags and changes the href value of the anchor tag.
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