I've decided not to implement the sending data portion of the program to retrieve a banner only because it may not be a good idea. Since anything can be run on port 80 there is no way of telling your program hey this is a webserver send a bad request. Plus getting non accurate results. So what's better not doing it? or sending data to a server that may not be a webserver and possibly getting falsy results(yes even if the banner is not changed)?. The banner grab portion of the program is still valuable since most banners will be the first prompt you get. Just not worth it in the long run to send data to a service and analyze the data that came back. The test program that works sort of right now (still have to implement a timer if a banner doesn't come back) works pretty good the results for example look like this:
Output:Code:import java.net.*; import java.io.*; public class Main { static BufferedReader socketin; static String socketBanner; static String host = "192.168.0.100"; static int port = 22; static Socket sck; public static void main(String args[]) throws IOException { try { sck = new Socket(host, port); readBanner(); disconnect(); } catch (UnknownHostException ex) { System.out.println(ex); } } public static void disconnect() throws IOException { sck.close(); } public static void readBanner() throws IOException { try { socketin = new BufferedReader(new InputStreamReader(sck.getInputStream())); socketBanner = socketin.readLine(); if(socketBanner.trim().length() == -1 || socketBanner.equals(null) ) { System.out.println("No Banner was found"); System.exit(1); } System.out.println("BANNER:" + socketBanner); } catch (UnknownHostException ex) { System.out.println("EXCEPTION READ BANNER:" + ex); } } }
BANNER:SSH-2.0-3.1.0 SSH Secure Shell Windows NT Server
Just have to implement a collection to hold the port, and banner also put in a timer cause as you can see it won't stop running till a output from a server is sent(needs a basic timmer). Since it's just a test program till I integrate into the scanner it should work pretty well.
Thanks anyways guys.




Reply With Quote