MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeBOFString

Method executeBOFString

workflow/executor.go:662–694  ·  view source on GitHub ↗

executeBOFString executes a BOF with string arguments

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

660
661// executeBOFString executes a BOF with string arguments
662func (e *Executor) executeBOFString(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
663 bofPath, ok := action.Parameters["bof"].(string)
664 if !ok {
665 return "", fmt.Errorf("bof parameter required")
666 }
667
668 // Read BOF file
669 bofData, err := os.ReadFile(bofPath)
670 if err != nil {
671 return "", fmt.Errorf("failed to read BOF file: %w", err)
672 }
673
674 bofBase64 := base64.StdEncoding.EncodeToString(bofData)
675
676 req := csclient.InlineExecuteStringDto{
677 BOF: "@files/bof.o",
678 Files: map[string]string{"bof.o": bofBase64},
679 }
680
681 if ep, ok := action.Parameters["entrypoint"].(string); ok {
682 req.Entrypoint = ep
683 }
684 if args, ok := action.Parameters["arguments"].(string); ok {
685 req.Arguments = args
686 }
687
688 resp, err := client.ExecuteBOFString(ctx, beaconID, req)
689 if err != nil {
690 return "", err
691 }
692
693 return e.waitForOutput(ctx, client, resp.TaskID)
694}
695
696// executeBOFPacked executes a BOF with packed arguments
697func (e *Executor) executeBOFPacked(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected