清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
package org.sl.util
/**
* Created by shanl on 14-3-18.
*/
class ScanPort implements Runnable{
String ip = "127.0.0.1"
def ports = [22,23,80]
int connectTimeout = 500
def result = []
def stderr = System.err.&println
def stdout = System.out.&println
@Override
void run() {
exec()
}
def exec(){
//def echo = []
Socket client = null
ports.each({
try{
client = new Socket()
client.connect(new InetSocketAddress(ip,it),connectTimeout)
result << it
}catch(Exception ex){
}finally{
try{
if(null!=client) client.close()
}catch(Exception ex){
}
}
})
return result
}
}