Thread: Java Port Scanner!

Results 1 to 3 of 3
  1. #1 Java Port Scanner! 
    Why Am I Not Vet?!

    Clouds Mine's Avatar
    Join Date
    May 2008
    Age
    28
    Posts
    2,400
    Thanks given
    1
    Thanks received
    21
    Rep Power
    1478
    This is a little port scanner I made. It's pretty fast because it uses the timeout feature within the connect method.

    Code:
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.net.Socket;
    import java.util.ArrayList;
    import java.util.List;
    
    /**
     * 
     * @author Trytohaxme
     * @version 1.0
     * 
     */
    public class Main implements Runnable {
    
        private List<Integer> ports = new ArrayList<Integer>();
        private String host = "put dam IP here.";
        
        public static void main(String[] args) {
            new Main();
        }
        
        public Main(){
            new Thread(this).start();
        }
        
        public void run(){
            for (int port = 1; port <= 65536; port++)
                try {
                    Socket socket = new Socket();
                    socket.bind(null);
                    socket.connect(new InetSocketAddress(host, port), 140);
                    socket.close();
                    System.out.println("Port: "+port);
                    ports.add(port);
                } catch (IOException ex) {
            }
            int portList = ports.size();
            System.out.println("Total Ports: "+portList);
        }
    }
    Reply With Quote  
     

  2. #2  
    Renown Programmer
    veer's Avatar
    Join Date
    Nov 2007
    Posts
    3,747
    Thanks given
    354
    Thanks received
    1,368
    Rep Power
    3032
    mines better:
    nmap
    Reply With Quote  
     

  3. #3  
    Mimz
    Guest
    Lol same here buddy
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •