import java.io.*;
import java.net.*;
import java.util.*;
public class ScanPort {
public static void main(String args[]) {
System.out.println();
System.out.println("---端口扫描---");
String startip = "", endip = "";
String sp1 = "", sp2 = "", sp3 = "";
int beginport, endport;
int maxThread = 0;
// 异常判断变量
int bport = 0, eport = 0;
boolean bool = false;
boolean bool1 = false;
boolean bool2 = false;
boolean bool3 = false;
boolean bool4 = false;
long xxx = 0, xxx2 = 0;
// 由用户输入扫描范围
// 读取输入开始ip
System.out.println();
System.out.println("输入exit退出程序~");
System.out.println("请输入起始ip:");
while (!bool) {
try {
BufferedReader in1 = new BufferedReader(new InputStreamReader(
System.in));
startip = in1.readLine();
if (startip.equals("exit")) {
bool = false;
System.out.println("退出程序!");
System.exit(0);
}
xxx = Com.ipj(startip);
if (xxx <= Com.ipj("1.0.0.0")) {
bool = false;
System.out.println("IP范围错误,请输入正确的起始ip:");
} else
bool = true;
} catch (IOException e) {
System.out.println("IP格式错误,请输入正确的起始ip:");
} catch (NumberFormatException e) {
System.out.println("IP格式错误,请输入正确的起始ip:");
} catch (StringIndexOutOfBoundsException e) {
System.out.println("IP格式错误,请输入正确的开始ip:");
} catch (NullPointerException e) {
System.out.print("退出程序!");
}
}