Wednesday, 16 November 2011

Magic of Javascript Injection

1. Resolve an IP Address of current page by JavaScript injection

javascript : alert(java.net.InetAddress.getByName(document.domain)); 

In earlier version of Internet Explorer and Mozila
type the above code in the address bar  and press enter
and open the scratchpad or webconsole in the latest browser to execute it.

In later version of IE , Mozila and Chrome
type the code in the goto tools and open web developer menu

like web console or scratchpad to run the above code

Note  : This code will only run if the jre is installed in the system


2. Get the date on your webpage

javascript : var d=new Date();document.write("The current date is " +d);

3. Get the number of images, links, embeds


javascript: alert("No. of images " + document.images.length); alert("No. of links " +document.links.length); alert("No of embeds " + document.embeds.length);