(self, ip_addr: str, port: Dict[str, Any])
| 82 | self.parse_vuln(app_name, script_table['elem']) |
| 83 | |
| 84 | def parse_port(self, ip_addr: str, port: Dict[str, Any]): |
| 85 | if port['state']['@state'] == 'closed': |
| 86 | return |
| 87 | |
| 88 | try: |
| 89 | app_name = self.get_app_name(port['service']) |
| 90 | except KeyError: |
| 91 | app_name = "unknown" |
| 92 | port_num = port['@portid'] |
| 93 | new_app = app_name not in self.results |
| 94 | self.results[app_name].locations[ip_addr].append(port_num) |
| 95 | |
| 96 | if new_app and 'script' in port: # vulnerabilities parsed only if this app didn't appear before |
| 97 | scripts = port['script'] |
| 98 | if isinstance(scripts, list): |
| 99 | for s in scripts: |
| 100 | if s['@id'] == 'vulners': |
| 101 | self.parse_script(ip_addr, port_num, app_name, s) |
| 102 | else: |
| 103 | if scripts['@id'] == 'vulners': |
| 104 | self.parse_script(ip_addr, port_num, app_name, scripts) |
| 105 | |
| 106 | def parse_host(self, host: Dict[str, Any]): |
| 107 | addresses = host['address'] |
no test coverage detected