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

Function ParseFileWithConfig

pkg/pe/parser.go:162–180  ·  view source on GitHub ↗

ParseFileWithConfig parses the PE given the file system path and the config which is usually read from the YAML file. Config flags are converted to parser options.

(path string, config Config)

Source from the content-addressed store, hash-verified

160// which is usually read from the YAML file. Config flags are converted to parser
161// options.
162func ParseFileWithConfig(path string, config Config) (*PE, error) {
163 if !config.Enabled {
164 return nil, nil
165 }
166 var opts []Option
167 if len(config.ExcludedImages) > 0 {
168 opts = append(opts, WithExcludedImages(config.ExcludedImages))
169 }
170 if config.ReadSections {
171 opts = append(opts, WithSections())
172 }
173 if config.ReadSymbols {
174 opts = append(opts, WithSymbols())
175 }
176 if config.ReadResources {
177 opts = append(opts, WithVersionResources())
178 }
179 return ParseFile(path, opts...)
180}
181
182// ParseBytes tries to parse the PE from the given byte slice and parser options.
183func ParseBytes(data []byte, opts ...Option) (*PE, error) {

Callers 2

newProcStateMethod · 0.92
FindMethod · 0.92

Calls 5

WithExcludedImagesFunction · 0.85
WithSectionsFunction · 0.85
WithSymbolsFunction · 0.85
WithVersionResourcesFunction · 0.85
ParseFileFunction · 0.85

Tested by

no test coverage detected