MCPcopy
hub / github.com/evilsocket/opensnitch / get_rule_by_uuid

Method get_rule_by_uuid

ui/opensnitch/firewall/__init__.py:140–155  ·  view source on GitHub ↗

get rule by uuid, in string format

(self, uuid, naddr=None)

Source from the content-addressed store, hash-verified

138 return self.rules.swap(view, addr, uuid, old_pos, new_pos)
139
140 def get_rule_by_uuid(self, uuid, naddr=None):
141 """get rule by uuid, in string format
142 """
143 if uuid == "":
144 return None, None
145 for addr in self._nodes.get_nodes():
146 node = self._nodes.get_node(addr)
147 if not 'fwrules' in node:
148 continue
149 if naddr is not None and naddr != addr:
150 continue
151 r = node['fwrules'].get(uuid)
152 if r is not None:
153 return addr, r
154
155 return None, None
156
157 def get_protorule_by_uuid(self, addr, uuid):
158 """get protobuffer rule by uuid.

Callers 3

change_rule_fieldMethod · 0.95
enable_ruleMethod · 0.95
loadMethod · 0.80

Calls 3

get_nodesMethod · 0.80
get_nodeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected