github.com/aquasecurity/fanal v0.0.0-20191205044128-99e4876e56b0
100+ functions have 50+ basic blocksBacktick shell command-substitution syntax
SHA-256b2a71cbdf20befc280c4db721b843382d102bb7a411fcb7ad381632d84512801
Evidence
1package redhatbase
2
3import (
4 "bufio"
5 "bytes"
6 "regexp"
7 "strings"
8
9 "golang.org/x/xerrors"
10
11 "github.com/aquasecurity/fanal/analyzer/os"
12
13 "github.com/aquasecurity/fanal/analyzer"
14 "github.com/aquasecurity/fanal/extractor"
15)
16
⋯5 lines
25:54… ileMap) (analyzer.OS, error) {
26 if file, ok := fileMap["etc/centos-release"]; ok {
27 scanner := bufio.NewScanner(bytes.NewBuffer(file))
28 for scanner.Scan() {
29 line := scanner.Text()
30 result := redhatR …
32:31… ors.New("cent: Invalid centos-release")
33 }
34
35 switch strings.ToLower(result[1]) {
36 case "centos", "centos linux":
37 return analyzer.OS{Family: os.CentOS, Name: result[2]}, nil
⋯5 lines
1package rpmcmd
2
3import (
4 "io/ioutil"
5 "reflect"
6 "testing"
7
8 "github.com/kylelemons/godebug/pretty"
9
10 "github.com/aquasecurity/fanal/analyzer"
11)
12
13func TestParseRpmInfo(t *testing.T) {
14 var tests = map[string]struct {
15 path string
⋯4 lines
78:115… SrcRelease: "5.fc28", SrcEpoch: 0, Arch: "x86_64"},
79 {Name: "krb5-libs", Version: "1.16.1", Release: "13.fc28", Epoch: 0, SrcName: "krb5", SrcVersion: "1.16.1", SrcRelease: "13.fc28", SrcEpoch: …
Showing the top 5 files — 2 more files (34 regions) not shown.