Class NMapProperties
Essentially the path needs to be to the location where the "bin" dir that contains the nmap binary is. Usually, when dealing with most nmap installs, this will also be location where the "share" dir is located. It's ideal to identify both of these of dirs as this allows you to specify the right share dir for a binary. Otherwise there is a risk that nmap will pick up a default in the system and this may introduce inconsistencies.
If you are planning to use the system property NMAP_HOME to set your NMap path, use the no arg constructor. Otherwise use the constructor with the String. If you want flexibility, set the path, use the no arg constructor and then use the setPath(String) method.
-
Constructor Summary
ConstructorDescriptionConstructs an instance of NMapProperties and looks in the environment properties for NMAP_HOME.NMapProperties
(String path) Contructs and instance of NMapProperties using the path passed. -
Method Summary
Modifier and TypeMethodDescriptionReturns the expected location of the share dir relative to the path set or passed in at construction time.This returns the full path to the nmap version to be executed.getPath()
Returns the current path.Returns the expected location of the share dir relative to the path set or passed in at construction time.void
Sets the path the bin dir where nmap can be found.
-
Constructor Details
-
NMapProperties
public NMapProperties()Constructs an instance of NMapProperties and looks in the environment properties for NMAP_HOME. If it is not found, the path is initialized to null and the API assumes that you will set it manually. See setPath(). -
NMapProperties
Contructs and instance of NMapProperties using the path passed.- Parameters:
path
-
-
-
Method Details
-
getPath
Returns the current path.- Returns:
-
setPath
Sets the path the bin dir where nmap can be found. This is also the path to the share dir which contains important files for nmap.For example, if the nmap bin dir is in /usr/local/share/bin/nmap the path you would set into this method is /usr/local/share .
- Parameters:
pathToBinDir
- - /the/path/to/nmapbindir.
-
getBinDir
Returns the expected location of the share dir relative to the path set or passed in at construction time. The value returned by this method is equivalent to that path variable + filesystem dependent separator + bin .- Returns:
-
getFullyFormattedCommand
This returns the full path to the nmap version to be executed.- Returns:
-