Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Add bytes counter to scans (#876)
Bill Rich034ca4fb5bf8
diff --git a/main.go b/main.goindex e8742c9ba..9f25fa250 100644--- a/main.go+++ b/main.go@@ -288,6 +288,7 @@ func run(state overseer.State) {}}logrus.Debugf("scanned %d chunks", e.ChunksScanned())+ logrus.Debugf("scanned %d bytes", e.BytesScanned())if *printAvgDetectorTime {printAverageDetectorTime(e)diff --git a/pkg/engine/engine.go b/pkg/engine/engine.goindex 75d813ebc..ea59b555e 100644--- a/pkg/engine/engine.go+++ b/pkg/engine/engine.go@@ -27,6 +27,7 @@ type Engine struct {decoders []decoders.Decoderdetectors map[bool][]detectors.DetectorchunksScanned uint64+ bytesScanned uint64detectorAvgTime sync.MapsourcesWg sync.WaitGroupworkersWg sync.WaitGroup@@ -140,6 +141,10 @@ func (e *Engine) ChunksScanned() uint64 {return e.chunksScanned}+func (e *Engine) BytesScanned() uint64 {+ return e.bytesScanned+}+func (e *Engine) DetectorAvgTime() map[string][]time.Duration {avgTime := map[string][]time.Duration{}e.detectorAvgTime.Range(func(k, v interface{}) bool {@@ -163,6 +168,7 @@ func (e *Engine) DetectorAvgTime() map[string][]time.Duration {func (e *Engine) detectorWorker(ctx context.Context) {for originalChunk := range e.chunks {for chunk := range sources.Chunker(originalChunk) {+ atomic.AddUint64(&e.bytesScanned, uint64(len(chunk.Data)))fragStart, mdLine := fragmentFirstLine(chunk)for _, decoder := range e.decoders {var decoderType detectorspb.DecoderType