MCPcopy Index your code
hub / github.com/MultSec/MultCheck / scanFile

Function scanFile

src/scan.go:13–35  ·  view source on GitHub ↗
(binaryPath string, conf map[string]string)

Source from the content-addressed store, hash-verified

11)
12
13func scanFile(binaryPath string, conf map[string]string) (bool, error) {
14 // Get absolute path
15 absPath, err := filepath.Abs(binaryPath)
16 if err != nil {
17 return false, fmt.Errorf("failed to get absolute path with error: %v", err)
18 }
19
20 // Replace placeholder with actual file path
21 cmd := strings.Replace(conf["cmd"], "{{file}}", absPath, -1)
22
23 // Execute the scanner command
24 output, err := exec.Command("powershell.exe", "-Command", cmd).CombinedOutput()
25 if runtime.GOOS != "windows" {
26 return false, fmt.Errorf("program only works on windows")
27 }
28
29 // Check if the output contains the positive detection
30 if strings.Contains(string(output), conf["out"]) {
31 return true, nil
32 } else {
33 return false, nil
34 }
35}
36
37func scanSlice(fileData []byte, conf map[string]string) (bool, error) {
38 // Create a temp file to scan

Callers 2

scanSliceFunction · 0.85
CheckMalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected