GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MaldocTrace/verdict_test.go at main · debugactiveprocess/MaldocTrace

Expand file tree

/

verdict_test.go

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
64 lines (59 loc) · 2.88 KB
/

verdict_test.go

Copy path

File metadata and controls

64 lines (59 loc) · 2.88 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package maldoctrace
import (
"context"
"testing"
"github.com/debugactiveprocess/MaldocTrace/report"
)
func TestVerdictLevels(t *testing.T) {
cases := []struct {
name string
r report.Report
want string
}{
{"nothing found", report.Report{Status: "complete", Macros: "absent"}, "clean"},
{"partial and nothing found", report.Report{Status: "partial", Macros: "absent"}, "unknown"},
{"undecrypted", report.Report{Status: "complete", Macros: "unknown", Encrypted: true}, "unknown"},
{"hyperlinks only", report.Report{Status: "complete", Macros: "absent",
StaticFindings: []report.StaticFinding{{Kind: "hyperlink", Severity: "low"}},
Indicators: []report.IOC{{Type: "url", Value: "https://example.com/"}}}, "clean"},
{"qr lure", report.Report{Status: "complete", Macros: "absent",
StaticFindings: []report.StaticFinding{{Kind: "qr_code_lure", Severity: "medium"}}}, "suspicious"},
{"auto-run macro", report.Report{Status: "complete", Macros: "present",
EntryPoints: []report.EntryPoint{{Module: "M", Proc: "AutoOpen"}}}, "suspicious"},
{"remote template", report.Report{Status: "complete", Macros: "absent",
StaticFindings: []report.StaticFinding{{Kind: "template_injection", Severity: "high"}}}, "malicious"},
{"command", report.Report{Status: "partial", Macros: "present",
Commands: []report.Command{{CommandLine: "cmd /c calc"}}}, "malicious"},
{"executable artifact", report.Report{Status: "complete", Macros: "present",
Artifacts: []report.Artifact{{FileType: "PE32 executable"}}}, "malicious"},
{"malicious child", report.Report{Status: "complete", Macros: "absent",
Children: []report.Child{{Source: "embedded_object", Name: "x", Report: &report.Report{Verdict: "malicious", RiskScore: 60}}}}, "malicious"},
}
for _, c := range cases {
r := c.r
computeVerdict(&r)
if r.Verdict != c.want {
t.Errorf("%s: verdict %s (score %d, %v), want %s", c.name, r.Verdict, r.RiskScore, r.VerdictReasons, c.want)
}
if r.RiskScore < 0 || r.RiskScore > 100 {
t.Errorf("%s: score %d out of range", c.name, r.RiskScore)
}
}
}
func TestVerdictAtLeast(t *testing.T) {
if !VerdictAtLeast("malicious", "suspicious") || VerdictAtLeast("suspicious", "malicious") ||
VerdictAtLeast("unknown", "suspicious") || VerdictAtLeast("clean", "suspicious") || !VerdictAtLeast("suspicious", "suspicious") {
t.Fatal("VerdictAtLeast ordering")
}
}
// The whole pipeline fills the verdict and the checks.
func TestPipelineVerdict(t *testing.T) {
r := AnalyzeVBA("Sub AutoOpen()\r\nShell \"cmd.exe /c calc.exe\"\r\nEnd Sub\r\n", "m.bas", Options{})
if r.Verdict != "malicious" || r.RiskScore < scoreMalicious || len(r.VerdictReasons) == 0 {
t.Fatalf("verdict %s %d %v", r.Verdict, r.RiskScore, r.VerdictReasons)
}
r = AnalyzeFromBytes(context.Background(), []byte{0, 1, 2, 3}, "x.bin", Options{})
if r.Verdict != "unknown" {
t.Fatalf("unrecognised input: verdict %s", r.Verdict)
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.