Selamat datang di blog saya

Terima kasih yach cos udah mau kunjungi blog saya mudah-mudahan bermanfaat :D

Senin, 29 Oktober 2012

port scanner

package yunita.main;

/**
 *
 * @author yuni
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class portscanner {
    public static void main(String[] args)
    {
        BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
        String remote = "localhost";
        int start = 80, end = 90;

        do
        {
            try
            {
                Socket s = new Socket(remote, start);
                //System.out.println("Port " + start + " of " + remote);
                System.out.println("Port " + start + " of " + remote + " OPEN");
                s.close();
            } catch (IOException ex)
            {
                System.out.println("Port " + start + " of " + remote + " close");
            }
            start++;
        } while (start <= end);
    }
}