Skip to content

Commit

Permalink
Merge pull request #890 from deepfence/v2-malware-secret
Browse files Browse the repository at this point in the history
V2 malware secret
  • Loading branch information
deviprasad303 authored Feb 10, 2023
2 parents 4d6260b + 4b6a3df commit c56ae00
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions deepfence_agent/tools/apache/scope/probe/host/malware_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package host
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -76,16 +77,14 @@ func StartMalwareScan(req ctl.StartMalwareScanRequest) error {
Container: &pb.MalwareContainer{Id: req.NodeId},
}}
case ctl.Image:
splits := strings.Split(req.NodeId, ";")
if len(splits) == 2 {
greq = pb.MalwareRequest{Input: &pb.MalwareRequest_Image{
Image: &pb.MalwareDockerImage{Id: splits[0], Name: splits[1]},
}}
} else {
greq = pb.MalwareRequest{Input: &pb.MalwareRequest_Image{
Image: &pb.MalwareDockerImage{Id: req.NodeId, Name: "dummy"},
}}
splits := strings.Split(req.BinArgs["node_id"], ";")

if len(splits) != 2 {
return errors.New("image id format is incorrect")
}
greq = pb.MalwareRequest{Input: &pb.MalwareRequest_Image{
Image: &pb.MalwareDockerImage{Id: req.NodeId, Name: splits[1]},
}}
case ctl.Host:
greq = pb.MalwareRequest{Input: &pb.MalwareRequest_Path{Path: MalwareScanDir}}
}
Expand Down

0 comments on commit c56ae00

Please sign in to comment.