mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
Validate, Discover, NewPlan, Execute, and Report run beside today's path: one snapshot per user data dir, each dir's keys retrieved once on first use, every record stamped by the collector. On the Chromium fixtures it writes the extract goldens byte for byte; the CLI switches over later.
37 lines
856 B
Go
37 lines
856 B
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"text/tabwriter"
|
|
)
|
|
|
|
// Report writes every result as one line, in output order. The summary is additive: it is not part of the output
|
|
// contract, and it never changes the exit status.
|
|
func Report(w io.Writer, s Summary) error {
|
|
tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0)
|
|
fmt.Fprintln(tw, "Browser\tProfile\tCategory\tResult\tRecords\tDetail")
|
|
for _, r := range s.Results {
|
|
profile, cat := "-", "-"
|
|
if r.Profile != "" {
|
|
profile = r.Profile
|
|
}
|
|
if r.Category != 0 {
|
|
cat = r.Category.String()
|
|
}
|
|
fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%s\n", r.DirID, profile, cat, r.Outcome, r.Count, detail(r))
|
|
}
|
|
return tw.Flush()
|
|
}
|
|
|
|
func detail(r Result) string {
|
|
switch {
|
|
case r.Err != nil:
|
|
return r.Err.Error()
|
|
case r.Failed > 0:
|
|
return fmt.Sprintf("%d not recovered", r.Failed)
|
|
default:
|
|
return ""
|
|
}
|
|
}
|