pinging…

So uhmm…. one or two days before I was giving talk on network & security tools under Linux under Lugb week . While showing demos I got stuck somewhere . I was using gooscan used as a google scanner to crawl google & fetch results from google search . As it started looking up google.com , got an error of Host not found: http://www.google.com . I tried pinging to http://www.google.com but nothing happen . So I just left that thing as it is & move on to next.  But the question remain unanswered for me , continuously bugging me .

So as I was about to sleep at night I got an idea to solve this problem using java. I retired from bed instantly & start writing a java program that fetch any site’s ip address for which it has to ping given URL , & that is all I wanted to test.

here is that program :

import java.util.*;
import java.lang.*;
import java.net.*;

public class ip
{
public static void main (String args[ ]){
try{
InetAddress my[ ]=InetAddress.getAllByName(“www.google.com”);
System.out.println(“IP of my system is:=”+my[0].getHostAddress());
}catch(Exception e){
System.out.println(“Exception has been caught=”+e.getMessage());
}
}
}

So when i execute it throws an exception while reading the address given to it. I thought a bit why it is still happening what this class basically does which i have used to query google.com in this program then i get to know that this class basically checks for the DNS & the puzzle solved.

Since I am under a squid proxy server & whenever I query for a DNS that request go to this proxy server not to the real server , in the same way when i try to ping http://www.google.com , request goes to proxy server not to google.com &  the host we actually required is not reachable , but it’s cache which is stored in  proxy server is reachable. Got it ?So another cool hack by me 😀 yeah yeah now stop making fun of me !

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s