mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 16:06:36 +01:00
* add support to upload results to enterprise Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add package sbom upload Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add dockerfile support Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add manifest, index, and dockerfile import functions Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * schema version to json output + enhance json schema generation Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * modify package SBOM shape to be entire syft document + add etui updates Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add import image config and manifest support Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add config options for import to enterprise Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * incorporate final stereoscope and client-go deps Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
32 lines
665 B
Go
32 lines
665 B
Go
package deb
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
"strings"
|
|
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
func parseDpkgMD5Info(reader io.Reader) []pkg.DpkgFileRecord {
|
|
// we must preallocate to ensure the resulting struct does not have null
|
|
var findings = make([]pkg.DpkgFileRecord, 0)
|
|
scanner := bufio.NewScanner(reader)
|
|
|
|
for scanner.Scan() {
|
|
line := scanner.Text()
|
|
fields := strings.SplitN(line, " ", 2)
|
|
if len(fields) == 2 {
|
|
path := strings.TrimSpace(fields[1])
|
|
if !strings.HasPrefix(path, "/") {
|
|
path = "/" + path
|
|
}
|
|
findings = append(findings, pkg.DpkgFileRecord{
|
|
Path: path,
|
|
MD5: strings.TrimSpace(fields[0]),
|
|
})
|
|
}
|
|
}
|
|
return findings
|
|
}
|