-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkics.go
31 lines (27 loc) · 956 Bytes
/
kics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
*
* This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
*/
package kics
import (
"log"
"path/filepath"
"github.com/Checkmarx/kics/internal/console"
"github.com/Checkmarx/kics/pkg/model"
"github.com/Checkmarx/kics/pkg/scan"
)
func ExecuteKICSScan(inputPaths []string, outputPath string, sciInfo model.SCIInfo) (scan.ScanMetadata, string) {
params := scan.GetDefaultParameters()
params.Path = inputPaths
params.OutputPath = outputPath
params.SCIInfo = sciInfo
metadata, err := console.ExecuteScan(params)
if err != nil {
log.Fatalf("failed to execute scan: %v", err)
return scan.ScanMetadata{}, ""
}
log.Printf("Scan completed successfully with metadata: %v", metadata)
resultsFile := filepath.Join(outputPath, params.OutputName)
return metadata, resultsFile
}