MCPcopy Index your code
hub / github.com/evilsocket/shellz / Load

Function Load

plugins/factory.go:18–30  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

16)
17
18func Load(path string) error {
19 log.Debug("loading plugins from %s ...", path)
20 return fs.Glob(path, "*.js", func(fileName string) error {
21 if err, plugin := LoadPlugin(fileName); err != nil {
22 return fmt.Errorf("error while loading plugin '%s': %s", fileName, err)
23 } else if taken, found := plugins[plugin.Name]; found {
24 return fmt.Errorf("plugin '%s' has name %s which is already taken by '%s'", fileName, plugin.Name, taken.Path)
25 } else {
26 plugins[plugin.Name] = plugin
27 }
28 return nil
29 })
30}
31
32func Get(sh models.Shell) *Plugin {
33 return plugins[sh.Type]

Callers 1

mainFunction · 0.92

Calls 2

LoadPluginFunction · 0.85
DebugMethod · 0.80

Tested by

no test coverage detected