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

Method to_array

ui/opensnitch/firewall/rules.py:291–319  ·  view source on GitHub ↗
(addr, chain, rule)

Source from the content-addressed store, hash-verified

289
290 @staticmethod
291 def to_array(addr, chain, rule):
292 cols = []
293 cols.append(rule.UUID)
294 cols.append(addr)
295 cols.append(chain.Name)
296 cols.append(chain.Table)
297 cols.append(chain.Family)
298 cols.append(chain.Hook)
299 cols.append(str(rule.Enabled))
300 cols.append(rule.Description)
301 exprs = ""
302 for e in rule.Expressions:
303 exprs += "{0} {1}".format(
304 e.Statement.Name,
305 "".join(
306 [
307 "{0} {1}{2} ".format(
308 h.Key,
309 e.Statement.Op + " " if e.Statement.Op != Operator.EQUAL.value else "",
310 "\"{0}\"".format(h.Value) if h.Key == ExprLog.PREFIX.value else h.Value
311 ) for h in e.Statement.Values
312 ]
313 )
314 )
315 cols.append(exprs)
316 cols.append(rule.Target)
317 cols.append(rule.TargetParameters)
318
319 return cols

Callers 5

filter_rulesMethod · 0.45
filter_by_tableMethod · 0.45
filter_by_chainMethod · 0.45
get_by_nodeMethod · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected