Class PortScannerImpl
java.lang.Object
com.github.toolarium.network.scanner.impl.PortScannerImpl
- All Implemented Interfaces:
IPortScanner
Implements the
IPortScanner.-
Field Summary
Fields inherited from interface com.github.toolarium.network.scanner.IPortScanner
MAX_PORT, MIN_PORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intprepareIntegerValue(int inputValue, int minValue, int maxValue) Prepare input int valueprotected Future<IPortScanResult> prepareNetworkAddressScanThread(ExecutorService es, String scanAddress, int port, int t, List<IPortScanListener> portScannerListenerList) Prepare the network address scan threadprotected List<IPortScanListener> preparePortScanListenerList(IPortScanListener... portScannerListeners) Prepare the port scan listener listprotected voidprepareResultSet(Boolean filterIsAvailable, List<IPortScanResult> result, Future<IPortScanResult> futurePortScanResult) Prepare the result setprepareScanAddressList(String scanAddress) Prepare the scan addressesscan(String scanAddress, int inputStartPort, int inputEndPort, Boolean filterIsAvailable, IPortScanListener... portScannerListeners) Scan a port range
-
Constructor Details
-
PortScannerImpl
public PortScannerImpl()Constructor -
PortScannerImpl
public PortScannerImpl(int numberOfThreads, int timeout) Constructor- Parameters:
numberOfThreads- the number of threadstimeout- the scan timeout
-
-
Method Details
-
scan
public List<IPortScanResult> scan(String scanAddress, int inputStartPort, int inputEndPort, Boolean filterIsAvailable, IPortScanListener... portScannerListeners) Description copied from interface:IPortScannerScan a port range- Specified by:
scanin interfaceIPortScanner- Parameters:
scanAddress- the scan addressinputStartPort- the start portinputEndPort- the end portfilterIsAvailable- filter the output: true only available ports, false only not available ports, both: nullportScannerListeners- a list of port scan listener- Returns:
- the port scan result list
- See Also:
-
prepareNetworkAddressScanThread
protected Future<IPortScanResult> prepareNetworkAddressScanThread(ExecutorService es, String scanAddress, int port, int t, List<IPortScanListener> portScannerListenerList) Prepare the network address scan thread- Parameters:
es- the executer servicescanAddress- the scan addressport- the portt- the timeoutportScannerListenerList- the port scanner listener list- Returns:
- the result
-
prepareResultSet
protected void prepareResultSet(Boolean filterIsAvailable, List<IPortScanResult> result, Future<IPortScanResult> futurePortScanResult) Prepare the result set- Parameters:
filterIsAvailable- true if the filter is availableresult- the result setfuturePortScanResult- the input port scan result
-
prepareIntegerValue
protected int prepareIntegerValue(int inputValue, int minValue, int maxValue) Prepare input int value- Parameters:
inputValue- the input valueminValue- the min valuemaxValue- the max value- Returns:
- the value
-
prepareScanAddressList
Prepare the scan addresses- Parameters:
scanAddress- the scan addresse(s)- Returns:
- the scan host address list
-
preparePortScanListenerList
protected List<IPortScanListener> preparePortScanListenerList(IPortScanListener... portScannerListeners) Prepare the port scan listener list- Parameters:
portScannerListeners- the port scan listener list- Returns:
- the port scan listener list
-