MCPcopy Create free account
hub / github.com/AutoRecon/AutoRecon / match_service

Method match_service

autorecon/plugins.py:138–164  ·  view source on GitHub ↗
(self, protocol, port, name, negative_match=False)

Source from the content-addressed store, hash-verified

136
137 @final
138 def match_service(self, protocol, port, name, negative_match=False):
139 protocol = protocol.lower()
140 if protocol not in ['tcp', 'udp']:
141 print('Invalid protocol.')
142 sys.exit(1)
143
144 if not isinstance(port, list):
145 port = [port]
146
147 port = list(map(int, port))
148
149 if not isinstance(name, list):
150 name = [name]
151
152 valid_regex = True
153 for r in name:
154 try:
155 re.compile(r)
156 except re.error:
157 print('Invalid regex: ' + r)
158 valid_regex = False
159
160 if not valid_regex:
161 sys.exit(1)
162
163 service = {'protocol': protocol, 'port': port, 'name': name, 'negative_match': negative_match}
164 self.services.append(service)
165
166 @final
167 def match_port(self, protocol, port, negative_match=False):

Callers 3

configureMethod · 0.80
configureMethod · 0.80
configureMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected