Log the result of an nmap command
(self, stdout: str, stderr: str, returncode: int, context: str = "")
| 55 | self.logger.info(f"COMMAND{context_str}: {command_str}") |
| 56 | |
| 57 | def log_result(self, stdout: str, stderr: str, returncode: int, context: str = ""): |
| 58 | """Log the result of an nmap command""" |
| 59 | with self.lock: |
| 60 | context_str = f" ({context})" if context else "" |
| 61 | |
| 62 | self.logger.info(f"RESULT{context_str}: Return code: {returncode}") |
| 63 | |
| 64 | if stdout: |
| 65 | self.logger.info(f"STDOUT{context_str}:") |
| 66 | for line in stdout.strip().split('\n'): |
| 67 | if line.strip(): |
| 68 | self.logger.info(f" {line}") |
| 69 | |
| 70 | if stderr: |
| 71 | self.logger.warning(f"STDERR{context_str}:") |
| 72 | for line in stderr.strip().split('\n'): |
| 73 | if line.strip(): |
| 74 | self.logger.warning(f" {line}") |
| 75 | |
| 76 | def log_scan_operation(self, operation: str, details: str = ""): |
| 77 | """Log a general nmap scan operation""" |
no test coverage detected