Port Scanner (Java)

xiaoxiao2021-03-06  69

Import java.net. *; import java.io. *;

Public Class Scanner Implements Runnable {Private inetaddress ipaddress; private thread allportthread;

Public Scanner (String ipaddress, int port) {TRY {this.ipaddress = this.ipaddress.getByname (ipaddress); this.port = port;} catch (exception e) {system.out.println ("The host does not exist) "}}

Public void run () {

Try {socket test = new socket (this.ipaddress, this.port); // if this port cannot been connection, throw a exception. system.out.println (this.port ": exist"); // if connected , Print out.} catch (exception e) {}}

Public static void main (string ") {string str; str =" TPOI Scanner 1.0 - Network host scanner / n "; str =" Author: TT (TPOI: http://www.tpoi.net) / n / N "; STR =" Usage: scanner / n / n "; str =" list: / n "; str =" -allport: scan the status of all the ports Of the specified host / n "; str =" -port% 0: Scan the status of the specified ports (% 0) of the specified host / n / n "; str =" examples: / n "; str = "Scanner -allport www.microsoft.com/n"; str = "scanner -port 80 21.64.34.191";

转载请注明原文地址:https://www.9cbs.com/read-108435.html

New Post(0)