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

Function stripShellMetadata

internal/sessions/transfer.go:298–314  ·  view source on GitHub ↗

stripShellMetadata removes exit code, wall time, and "Output:" lines.

(output string)

Source from the content-addressed store, hash-verified

296
297// stripShellMetadata removes exit code, wall time, and "Output:" lines.
298func stripShellMetadata(output string) string {
299 lines := strings.Split(output, "\n")
300 var cleaned []string
301 outputSectionStarted := false
302 for _, line := range lines {
303 trimmed := strings.TrimSpace(line)
304 if trimmed == "Output:" {
305 outputSectionStarted = true
306 continue
307 }
308 if !outputSectionStarted && shellMetaRe.MatchString(trimmed) {
309 continue
310 }
311 cleaned = append(cleaned, line)
312 }
313 return strings.Join(cleaned, "\n")
314}
315
316// DecodeBase64Output strips shell metadata and line-number prefixes from
317// command output, then base64-decodes the result.

Callers 2

ParseFileSizeOutputFunction · 0.85
DecodeBase64OutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected