Class PortScannerImpl

java.lang.Object
com.github.toolarium.network.scanner.impl.PortScannerImpl
All Implemented Interfaces:
IPortScanner

public class PortScannerImpl extends Object implements IPortScanner
Implements the IPortScanner.
  • Constructor Details

    • PortScannerImpl

      public PortScannerImpl()
      Constructor
    • PortScannerImpl

      public PortScannerImpl(int numberOfThreads, int timeout)
      Constructor
      Parameters:
      numberOfThreads - the number of threads
      timeout - the scan timeout
  • Method Details

    • scan

      public List<IPortScanResult> scan(String scanAddress, int inputStartPort, int inputEndPort, Boolean filterIsAvailable, IPortScanListener... portScannerListeners)
      Description copied from interface: IPortScanner
      Scan a port range
      Specified by:
      scan in interface IPortScanner
      Parameters:
      scanAddress - the scan address
      inputStartPort - the start port
      inputEndPort - the end port
      filterIsAvailable - filter the output: true only available ports, false only not available ports, both: null
      portScannerListeners - 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 service
      scanAddress - the scan address
      port - the port
      t - the timeout
      portScannerListenerList - 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 available
      result - the result set
      futurePortScanResult - the input port scan result
    • prepareIntegerValue

      protected int prepareIntegerValue(int inputValue, int minValue, int maxValue)
      Prepare input int value
      Parameters:
      inputValue - the input value
      minValue - the min value
      maxValue - the max value
      Returns:
      the value
    • prepareScanAddressList

      protected List<String> prepareScanAddressList(String scanAddress)
      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