(event)
| 79 | } |
| 80 | |
| 81 | function extractShellCommand(event) { |
| 82 | if (!event || typeof event !== "object") { |
| 83 | return null; |
| 84 | } |
| 85 | |
| 86 | const candidates = [ |
| 87 | event.command, |
| 88 | event.cmd, |
| 89 | event.parameters?.cmd, |
| 90 | event.arguments?.cmd, |
| 91 | event.payload?.command, |
| 92 | event.payload?.cmd, |
| 93 | ]; |
| 94 | |
| 95 | for (const candidate of candidates) { |
| 96 | if (typeof candidate === "string" && candidate.trim()) { |
| 97 | return candidate.trim(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | if (event.recipient_name === "functions.exec_command") { |
| 102 | return event.parameters?.cmd || event.arguments?.cmd || event.command || "functions.exec_command"; |
| 103 | } |
| 104 | |
| 105 | return null; |
| 106 | } |
| 107 | |
| 108 | function extractToolName(event) { |
| 109 | if (!event || typeof event !== "object") { |
no outgoing calls
no test coverage detected