(self, line, regex)
| 253 | self.argparse_group.add_argument(name, **kwargs) |
| 254 | |
| 255 | def extract_service(self, line, regex): |
| 256 | if regex is None: |
| 257 | regex = '^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$' |
| 258 | match = re.search(regex, line) |
| 259 | if match: |
| 260 | protocol = match.group('protocol').lower() |
| 261 | port = int(match.group('port')) |
| 262 | service = match.group('service') |
| 263 | secure = True if 'ssl' in service or 'tls' in service else False |
| 264 | |
| 265 | if service.startswith('ssl/') or service.startswith('tls/'): |
| 266 | service = service[4:] |
| 267 | |
| 268 | return Service(protocol, port, service, secure) |
| 269 | else: |
| 270 | return None |
| 271 | |
| 272 | async def extract_services(self, stream, regex): |
| 273 | if not isinstance(stream, CommandStreamReader): |
no test coverage detected