<%@page import="java.util.*,java.io.*,java.net.*" %> <%@page pageEncoding="gbk"%> <%! //author : kj021320(nonamed) //blog : http://blog.csdn.net/kj021320/ ArrayList threadScheduler=new ArrayList();//JOB Scheduler public class JobConsole{ ArrayList subThreadsPool=new ArrayList();//sub Threads pool public int port;//开始端口 public int endPort;//结束端口 public int state=0;//0进行 1暂停 2停止 public String host;//IP地址 public String errMsg="";//错误信息 public StringBuffer succMsg=new StringBuffer();//成功信息 public int threadCount=0; public void start(){ for(int c=1;c<=threadCount;c++){ ScanThread st=new ScanThread(); st.parent=this; subThreadsPool.add(st); st.start(); st=null; } } } //创建一个扫描的线程类 public class ScanThread extends Thread{ public JobConsole parent; public int port;//开始端口 public void run(){ for(;port<=parent.endPort;){ synchronized(parent){port=parent.port++;}//同步处理端口问题 while(parent.state==1){ try{Thread.sleep(3000);}catch(Exception e){parent.errMsg=e.getMessage();} } if(parent.state==2){return;} try { Socket s=new Socket(parent.host,port); synchronized(parent.succMsg){ parent.succMsg.append(port+","); } s.close(); } catch (UnknownHostException e) { parent.endPort=0; synchronized(parent.errMsg){ parent.errMsg=e.getMessage(); } } catch (IOException e) { } } parent.state=2; } } %> <% //System.out.println(request.getQueryString()); String action = request.getParameter("Action"); if(action!=null&&!"".equals(action)){ if("AddToScan".equals(action)){ String host=request.getParameter("host");//取得主机名字 String port=request.getParameter("port");//取得开始port String endPort=request.getParameter("endPort");//取得结束port String thread=request.getParameter("thread");//取得线程 JobConsole jc=new JobConsole(); jc.host=host; jc.port=Integer.parseInt(port); jc.endPort=Integer.parseInt(endPort); jc.threadCount=Integer.parseInt(thread); threadScheduler.add(jc); jc.start(); jc=null; }else if("del".equals(action)){ int num=Integer.parseInt(request.getParameter("id")); JobConsole jc=(JobConsole)threadScheduler.remove(num); jc.state=2;//更改状态为stop jc.subThreadsPool.clear();//清楚线程池里面的所有线程 jc=null; System.gc(); }else if("Run".equals(action)){ int num=Integer.parseInt(request.getParameter("id")); JobConsole jc=(JobConsole)threadScheduler.get(num); jc.state=0;//running 状态 jc.start();//重新开始 jc=null; System.gc();//清除垃圾 }else if("Pause".equals(action)){ int num=Integer.parseInt(request.getParameter("id")); JobConsole jc=(JobConsole)threadScheduler.get(num); jc.state=1;//pause 状态 jc=null; System.gc();//清除垃圾 }else if("Continue".equals(action)){ int num=Integer.parseInt(request.getParameter("id")); JobConsole jc=(JobConsole)threadScheduler.get(num); jc.state=0;//running 状态 jc=null; System.gc();//清除垃圾 }else{ out.println(""); int count=threadScheduler.size(); for(int i=0;i";break; case 1:scanState="pause";operate="";break; case 2:scanState="stop";operate="";break; } out.println(""); out.println(""); out.println(""); jc=null; } out.println("
JOBTHREADSTATEHOSTSCANNING...END PORTSUCC MSGERR MSGACTION
"+i+""+jc.threadCount+""+scanState+""+jc.host+""+(jc.port-1)+""+jc.endPort+""+jc.succMsg+""+jc.errMsg+""+operate+"
"); } return; } %> ISTO Extreme JScanning 1.0
Scheduler Pool:

HOST: START PORT: END PORT: THREAD:
- = Information Security Technology Organization = - -= I.S.T.O =-