Get status of all advanced features
(self)
| 264 | self.capabilities.hostname = platform.node() |
| 265 | self.capabilities.os_name = platform.system() |
| 266 | self.capabilities.os_version = platform.release() |
| 267 | self.capabilities.kernel_version = platform.version() |
| 268 | |
| 269 | # Common locations a package-manager install drops binaries, checked when |
| 270 | # they aren't on PATH — a systemd service can run with a thin PATH that |
| 271 | # misses /usr/bin, which would hide an apt-installed nmap. |
| 272 | _TOOL_BIN_DIRS = ('/usr/bin', '/usr/local/bin', '/usr/sbin', '/bin', |
| 273 | '/sbin', '/snap/bin') |
| 274 | |
| 275 | @classmethod |
| 276 | def _tool_present(cls, tool_name): |
| 277 | """True if `tool_name` is on PATH or in a common bin dir.""" |
| 278 | if shutil.which(tool_name): |
| 279 | return True |
| 280 | return any(os.path.exists(os.path.join(d, tool_name)) |
no test coverage detected