MCPcopy
hub / github.com/crowdsecurity/crowdsec / dumpHubItems

Method dumpHubItems

cmd/crowdsec-cli/clisupport/support.go:221–240  ·  view source on GitHub ↗
(zw *zip.Writer, hub *cwhub.Hub)

Source from the content-addressed store, hash-verified

219}
220
221func (cli *cliSupport) dumpHubItems(zw *zip.Writer, hub *cwhub.Hub) error {
222 fmt.Fprintln(os.Stdout, "Collecting hub")
223
224 if hub == nil {
225 return errors.New("no hub connection")
226 }
227
228 out := new(bytes.Buffer)
229 ch := clihub.New(cli.cfg)
230
231 if err := ch.List(out, hub, false); err != nil {
232 return err
233 }
234
235 stripped := stripAnsiString(out.String())
236
237 cli.writeToZip(zw, SUPPORT_HUB, time.Now(), strings.NewReader(stripped))
238
239 return nil
240}
241
242func (cli *cliSupport) dumpBouncers(ctx context.Context, zw *zip.Writer, db *database.Client) error {
243 fmt.Fprintln(os.Stdout, "Collecting bouncers")

Callers 1

dumpMethod · 0.95

Calls 6

writeToZipMethod · 0.95
NewFunction · 0.92
stripAnsiStringFunction · 0.85
NewReaderMethod · 0.80
ListMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected