Package org.nmap4j.core.scans
Interface IScan
- All Known Implementing Classes:
BaseScan
,HostDiscovery
,ServiceDiscovery
public interface IScan
Parent interface of all Scan implentations. Allows you to customize the
scan behavior if for any reason the BaseScan doesn't meet your needs.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified flag to the underlying ArgumentProperties object.void
addPort
(int port) Adds a single port to the scan spec; adds the implied -p flag.void
addPorts
(int[] ports) Allows you to add ports in a block; this can also be called repetitively.void
excludeHost
(String host) Add a single host to the list of excluded hosts.void
excludeHosts
(String[] hosts) Add the array of hosts to the list of hosts that are excluded.void
Execute a scan asynchronously; you must pass in a callback in order for this to work.Executes a scan and blocks while scan runs.This provides access to the member variable for the ArgumentProperties.This provides access to the member variable for the NMapProperties.void
includeHost
(String host) Add a single host to the list of hosts.void
includeHosts
(String[] hosts) Add the the hosts from the array.void
removeExcludeHost
(String host) Remove one host from the list of excluded hosts.void
removeExcludeHosts
(String[] hosts) Remove the list of hosts from the list of hosts that should be excluded from a scan.void
removeFlag
(Flag flag) Removes the specified flag from the underlying ArgumentProperties object.void
removeIncludeHost
(String host) Removes the specified host from the list of included hosts.void
removeIncludeHosts
(String[] hosts) Removes all the hosts in the array from the list of included hosts.void
setNMapPath
(String path) Specifies the path in which to look for the nmap binaries and share directory.void
setOutputType
(IScan.OutputType ot, String fileName) Sets the output type flag accordingly and also sets the filename.void
Allows for a controlled way to vet a scan configuration.void
Sets the scan timing flag.
-
Method Details
-
setTiming
Sets the scan timing flag.- Parameters:
tf
-
-
addPort
void addPort(int port) Adds a single port to the scan spec; adds the implied -p flag. You can call this method repetitively to add ports.- Parameters:
port
-
-
addPorts
void addPorts(int[] ports) Allows you to add ports in a block; this can also be called repetitively.- Parameters:
ports
-
-
includeHost
Add a single host to the list of hosts. Additive.- Parameters:
host
-
-
includeHosts
Add the the hosts from the array. Additive.- Parameters:
hosts
-
-
excludeHost
Add a single host to the list of excluded hosts. Additive.- Parameters:
host
-
-
excludeHosts
Add the array of hosts to the list of hosts that are excluded. Additive.- Parameters:
hosts
-
-
removeIncludeHost
Removes the specified host from the list of included hosts.- Parameters:
host
-
-
removeIncludeHosts
Removes all the hosts in the array from the list of included hosts. Should not throw any exceptions if a host in the array is not in the current list.- Parameters:
hosts
-
-
removeExcludeHost
Remove one host from the list of excluded hosts.- Parameters:
host
-
-
removeExcludeHosts
Remove the list of hosts from the list of hosts that should be excluded from a scan.- Parameters:
hosts
-
-
setOutputType
Sets the output type flag accordingly and also sets the filename. This method should be used to override the default behavior, writing XML to the std out.- Parameters:
ot
-
-
executeScan
ExecutionResults executeScan() throws ParameterValidationFailureException, NMapExecutionException, NMapInitializationExceptionExecutes a scan and blocks while scan runs. If your scan is long running consider using the executeAsynchronousExecute() method. -
executeAsynchronousScan
void executeAsynchronousScan(IScanCallback isc) throws ParameterValidationFailureException, NMapExecutionException Execute a scan asynchronously; you must pass in a callback in order for this to work.- Parameters:
isc
-- Throws:
ParameterValidationFailureException
NMapExecutionException
-
setScanValidator
Allows for a controlled way to vet a scan configuration. Allows API users to verify the right combination of flags, the right values for things like ports or hosts (for example, allows users to prevent hosts from being scanned, etc).- Parameters:
isv
-- Throws:
ParameterValidationFailureException
-
setNMapPath
Specifies the path in which to look for the nmap binaries and share directory. If this is not set, the API will try to use the environmental variable NMAP_HOME.- Parameters:
path
-
-
addFlag
Adds the specified flag to the underlying ArgumentProperties object. -
removeFlag
Removes the specified flag from the underlying ArgumentProperties object. -
getArgumentProperties
ArgumentProperties getArgumentProperties()This provides access to the member variable for the ArgumentProperties.- Returns:
-
getNMapProperties
NMapProperties getNMapProperties()This provides access to the member variable for the NMapProperties.- Returns:
-