MCPcopy
hub / github.com/apache/caldera / replace

Method replace

app/objects/c_agent.py:226–235  ·  view source on GitHub ↗
(self, encoded_cmd, file_svc)

Source from the content-addressed store, hash-verified

224 self.update('sleep_max', 60 * 2)
225
226 def replace(self, encoded_cmd, file_svc):
227 decoded_cmd = b64decode(encoded_cmd).decode('utf-8', errors='ignore').replace('\n', '')
228 decoded_cmd = decoded_cmd.replace(self.RESERVED['server'], self.server)
229 decoded_cmd = decoded_cmd.replace(self.RESERVED['group'], self.group)
230 decoded_cmd = decoded_cmd.replace(self.RESERVED['agent_paw'], self.paw)
231 decoded_cmd = decoded_cmd.replace(self.RESERVED['location'], self.location)
232 decoded_cmd = decoded_cmd.replace(self.RESERVED['exe_name'], self.exe_name)
233 decoded_cmd = decoded_cmd.replace(self.RESERVED['upstream_dest'], self.upstream_dest)
234 decoded_cmd = self._replace_payload_data(decoded_cmd, file_svc)
235 return decoded_cmd
236
237 def privileged_to_run(self, ability):
238 if not ability.privilege or self.Privileges[self.privilege].value >= self.Privileges[ability.privilege].value:

Callers 15

uuidv4Function · 0.80
peFunction · 0.80
zrFunction · 0.80
alpine.min.jsFile · 0.80
TnFunction · 0.80
knFunction · 0.80
FnFunction · 0.80
VnFunction · 0.80
YnFunction · 0.80
ArFunction · 0.80
lFunction · 0.80

Calls 2

_replace_payload_dataMethod · 0.95
decodeMethod · 0.45

Tested by 1

test_escaped_shMethod · 0.64