2023-06-22 15:02:25 +00:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"google.golang.org/protobuf/types/known/anypb"
|
|
|
|
|
|
|
|
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
|
|
|
|
"github.com/trufflesecurity/trufflehog/v3/pkg/sources/docker"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ScanDocker scans a given docker connection.
|
|
|
|
func (e *Engine) ScanDocker(ctx context.Context, conn *anypb.Any) error {
|
2023-09-12 23:58:38 +00:00
|
|
|
sourceName := "trufflehog - docker"
|
2023-09-13 00:23:25 +00:00
|
|
|
sourceID, jobID, _ := e.sourceManager.GetIDs(ctx, sourceName, docker.SourceType)
|
2023-09-12 23:58:38 +00:00
|
|
|
|
|
|
|
dockerSource := &docker.Source{}
|
2023-09-14 18:28:24 +00:00
|
|
|
if err := dockerSource.Init(ctx, sourceName, jobID, sourceID, true, conn, runtime.NumCPU()); err != nil {
|
2023-08-03 18:36:30 +00:00
|
|
|
return err
|
2023-06-22 15:02:25 +00:00
|
|
|
}
|
2023-09-12 23:58:38 +00:00
|
|
|
_, err := e.sourceManager.Run(ctx, sourceName, dockerSource)
|
2023-08-03 18:36:30 +00:00
|
|
|
return err
|
2023-06-22 15:02:25 +00:00
|
|
|
}
|