| 165 | |
| 166 | @final |
| 167 | def match_port(self, protocol, port, negative_match=False): |
| 168 | protocol = protocol.lower() |
| 169 | if protocol not in ['tcp', 'udp']: |
| 170 | print('Invalid protocol.') |
| 171 | sys.exit(1) |
| 172 | else: |
| 173 | if not isinstance(port, list): |
| 174 | port = [port] |
| 175 | |
| 176 | port = list(map(int, port)) |
| 177 | |
| 178 | if negative_match: |
| 179 | self.ignore_ports[protocol] = list(set(self.ignore_ports[protocol] + port)) |
| 180 | else: |
| 181 | self.ports[protocol] = list(set(self.ports[protocol] + port)) |
| 182 | |
| 183 | @final |
| 184 | def match_service_name(self, name, negative_match=False): |