Skip to content

Commit

Permalink
Ignore low severity malwares
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanan-ravi committed Dec 4, 2024
1 parent 1b00031 commit 175ceb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
9 changes: 4 additions & 5 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ package output
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"unicode/utf8"

"github.com/deepfence/YaraHunter/utils"
pb "github.com/deepfence/agent-plugins-grpc/srcgo"
log "github.com/sirupsen/logrus"

// "github.com/fatih/color"

"os"
"strings"
"time"
"unicode/utf8"

tw "github.com/olekukonko/tablewriter"
)

Expand Down
20 changes: 6 additions & 14 deletions pkg/scan/process_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package scan
import (
"bytes"
"errors"
"fmt"
"io"
"math"
"os/exec"
Expand All @@ -11,8 +12,6 @@ import (
"syscall"
"unsafe"

"fmt"

"github.com/gabriel-vasile/mimetype"

"github.com/deepfence/YaraHunter/pkg/output"
Expand All @@ -34,13 +33,6 @@ type manifestItem struct {
LayerIds []string `json:",omitempty"`
}

type fileMatches struct {
fileName string
iocs []output.IOCFound
updatedScore float64
updatedSeverity string
}

func calculateSeverity(lenMatch int, severity string, severityScore float64) (string, float64) {

updatedSeverity := "low"
Expand Down Expand Up @@ -214,12 +206,12 @@ func ScanFile(s *Scanner, fileName string, f io.ReadSeeker, fsize int, iocs *[]o
Matches: matches,
})
}
var fileMat fileMatches
fileMat.fileName = fileName
fileMat.iocs = iocsFound
updatedSeverity, updatedScore := calculateSeverity(totalMatches, "low", 0)
fileMat.updatedSeverity = updatedSeverity
fileMat.updatedScore = updatedScore
//if updatedSeverity == "low" {
// // Ignore low severity malwares
// return nil
//}
logrus.Infof("Updated severity: %s", updatedSeverity)
if len(matches) > 0 {
for _, m := range iocsFound {
m.FileSeverity = updatedSeverity
Expand Down

0 comments on commit 175ceb6

Please sign in to comment.