Determine What Web Server Is Installed on a Remote Machine

Using Java, you can easily find out what Web server is installed on a remote machine. Just open a URLConnection to the remote host and parse the header for the “Server” entity, which will give the name of the Web server.

 //pass the site address as command line argument//eg:- java http://www.javasoft.comimport java.io.*;import java.net.*;public class findServer{    public static void main(String a[])    {        try        {            URL u=new URL(a[0]);            System.out.println("Web server of site"+a[0]+"is -"+u.openConnection().getHeaderField("Server"));        }        catch(Exception e)        {            System.out.println(e);        }    }}
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: