Port Scanner (Java)

zhaozj2021-02-16  40

import java.net *;. import java.io. *; public class Scanner implements Runnable {private InetAddress IPAddress; private int Port; 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 ()}} public void Run ()}} public void run ()}} Socket (this.ipaddress, this.port); // if this port cannot been connection, throw a exception. System.out.println (this.port ": exist"); // if connection, print out.} Catch (Exception e) {}} public static void main (string "argg) {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 " ; If (args.length == 0) {system.out.println (STR);} else {args [0] = args [0] .touppercase (). Trim (); char switchargs = args [0] .CHARAT (1); switch (switchargs) {CASE 'A': {for (int i = 1; i <= 65535; i ) {Scanner Mainscanner = New Scanner (Args [1], I); IF (MAINSCANNNER.Allportthread. ActiveCount ()> 100) mainscanner.run ();

else {mainScanner.allportThread = new Thread (mainScanner); mainScanner.allportThread.start ();}} break;} case 'P': {Scanner mainScanner = new Scanner (args [2], java.lang.Integer.parseInt ( Args [1], 10)); try {mainscanner.run ();} catch (exception e) {system.out.println ("parameter error");} Break;} default: system.out.println (STR) }}}} The younger brother is a student who just started to read DEGREE.

I really want to make friends with a high man MSN: zhuo_chang@hotmail.comqqqq: 367271

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

New Post(0)