MCPcopy
hub / github.com/USArmyResearchLab/Dshell / __update_bpf

Method __update_bpf

dshell/plugins/ftp/ftp.py:56–74  ·  view source on GitHub ↗

Dynamically change the BPF to allow processing of data transfer channels.

(self)

Source from the content-addressed store, hash-verified

54 )
55
56 def __update_bpf(self):
57 """
58 Dynamically change the BPF to allow processing of data transfer
59 channels.
60 """
61 dynfilters = []
62 for conn, metadata in self.conns.items():
63 try:
64 dynfilters += ["(host %s and host %s)" % metadata["tempippair"]]
65 except (KeyError, TypeError):
66 continue
67 for a, p in self.data_channel_map.keys():
68 dynfilters += ["(host %s and port %d)" % (a, p)]
69 self.bpf = "(%s) and ((%s)%s)" % (
70 self.original_bpf,
71 " or ".join( "port %d" % p for p in self.control_ports ),
72 " or " + " or ".join(dynfilters) if dynfilters else ""
73 )
74 self.recompile_bpf()
75
76 def premodule(self):
77 # dictionary containing metadata for connections

Callers 2

blob_handlerMethod · 0.95

Calls 1

recompile_bpfMethod · 0.80

Tested by

no test coverage detected