MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / DecodeBase64Output

Function DecodeBase64Output

internal/sessions/transfer.go:318–331  ·  view source on GitHub ↗

DecodeBase64Output strips shell metadata and line-number prefixes from command output, then base64-decodes the result.

(output string)

Source from the content-addressed store, hash-verified

316// DecodeBase64Output strips shell metadata and line-number prefixes from
317// command output, then base64-decodes the result.
318func DecodeBase64Output(output string) ([]byte, error) {
319 // 1. Strip shell metadata (exit code, wall time, "Output:" header).
320 cleaned := stripShellMetadata(output)
321 // 2. Strip line-number prefixes.
322 cleaned = StripReadToolLineNumbers(cleaned)
323 // 3. Remove all whitespace (base64 may be wrapped at 76 chars).
324 cleaned = strings.Join(strings.Fields(cleaned), "")
325
326 if cleaned == "" {
327 return []byte{}, nil
328 }
329
330 return base64.StdEncoding.DecodeString(cleaned)
331}

Calls 2

stripShellMetadataFunction · 0.85
StripReadToolLineNumbersFunction · 0.85