MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / parserOpts

Method parserOpts

pkg/filter/accessor_windows.go:1033–1071  ·  view source on GitHub ↗

parserOpts traverses all fields/segments declared in the expression and dynamically determines what aspects of the PE need to be parsed.

()

Source from the content-addressed store, hash-verified

1031// parserOpts traverses all fields/segments declared in the expression and
1032// dynamically determines what aspects of the PE need to be parsed.
1033func (pa *peAccessor) parserOpts() []pe.Option {
1034 var opts []pe.Option
1035 var peSections bool
1036
1037 for _, f := range pa.fields {
1038 if f.Name.IsPeSectionsPseudo() {
1039 peSections = true
1040 }
1041 if f.Name.IsPeSection() || f.Name.IsPeModified() {
1042 opts = append(opts, pe.WithSections())
1043 }
1044 if f.Name.IsPeSymbol() {
1045 opts = append(opts, pe.WithSymbols())
1046 }
1047 if f.Name.IsPeVersionResource() || f.Name.IsPeVersionResources() {
1048 opts = append(opts, pe.WithVersionResources())
1049 }
1050 if f.Name.IsPeImphash() {
1051 opts = append(opts, pe.WithImphash())
1052 }
1053 if f.Name.IsPeDotnet() || f.Name.IsPeModified() {
1054 opts = append(opts, pe.WithCLR())
1055 }
1056 if f.Name.IsPeAnomalies() {
1057 opts = append(opts, pe.WithSections(), pe.WithSymbols())
1058 }
1059 if f.Name.IsPeSignature() {
1060 opts = append(opts, pe.WithSecurity())
1061 }
1062 }
1063
1064 for _, s := range pa.segments {
1065 if peSections && s.IsEntropy() {
1066 opts = append(opts, pe.WithSections(), pe.WithSectionEntropy())
1067 }
1068 }
1069
1070 return opts
1071}
1072
1073// ErrPeNilCertificate indicates the PE certificate is not available
1074var ErrPeNilCertificate = errors.New("pe certificate is nil")

Callers 1

GetMethod · 0.95

Calls 15

WithSectionsFunction · 0.92
WithSymbolsFunction · 0.92
WithVersionResourcesFunction · 0.92
WithImphashFunction · 0.92
WithCLRFunction · 0.92
WithSecurityFunction · 0.92
WithSectionEntropyFunction · 0.92
IsPeSectionsPseudoMethod · 0.80
IsPeSectionMethod · 0.80
IsPeModifiedMethod · 0.80
IsPeSymbolMethod · 0.80
IsPeVersionResourceMethod · 0.80

Tested by

no test coverage detected