added host name support
This commit is contained in:
@ -9,6 +9,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author joern.muehlencord
|
* @author joern.muehlencord
|
||||||
@ -20,6 +21,7 @@ public class PortScanner {
|
|||||||
private final int startPort;
|
private final int startPort;
|
||||||
private final int endPort;
|
private final int endPort;
|
||||||
private final int timeout;
|
private final int timeout;
|
||||||
|
private String host = null;
|
||||||
|
|
||||||
public PortScanner(int timeoutInMs, int startPort, int endPort) {
|
public PortScanner(int timeoutInMs, int startPort, int endPort) {
|
||||||
this.startPort = startPort;
|
this.startPort = startPort;
|
||||||
@ -32,6 +34,7 @@ public class PortScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PortInformation> scan(String ip) {
|
public List<PortInformation> scan(String ip) {
|
||||||
|
this.host = ip;
|
||||||
|
|
||||||
final List<PortInformation> resultList = new ArrayList<>();
|
final List<PortInformation> resultList = new ArrayList<>();
|
||||||
final ExecutorService es = Executors.newFixedThreadPool(20);
|
final ExecutorService es = Executors.newFixedThreadPool(20);
|
||||||
@ -53,6 +56,10 @@ public class PortScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* *** getter *** */
|
/* *** getter *** */
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
public int getStartPort() {
|
public int getStartPort() {
|
||||||
return startPort;
|
return startPort;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user