MCPcopy Create free account
hub / github.com/evilsocket/shellz / Init

Function Init

models/paths.go:18–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16)
17
18func Init() (err error) {
19 log.Debug("initializing models.Paths from %s ...", Path)
20
21 Paths = map[string]string{
22 "idents": filepath.Join(Path, "idents"),
23 "shells": filepath.Join(Path, "shells"),
24 "plugins": filepath.Join(Path, "plugins"),
25 }
26
27 for name, path := range Paths {
28 if Paths[name], err = fs.Expand(path); err != nil {
29 return fmt.Errorf("error while expanding path '%s': %s", path, err)
30 } else {
31 path = Paths[name]
32 }
33
34 log.Debug("models.Paths[%s] = %s", name, path)
35 if !fs.Exists(path) {
36 log.Info("creating folder %s ...", path)
37 if err = os.MkdirAll(path, os.ModePerm); err != nil {
38 return fmt.Errorf("error while creating path '%s': %s", path, err)
39 }
40 }
41 }
42
43 return
44}

Callers 1

mainFunction · 0.92

Calls 2

DebugMethod · 0.80
InfoMethod · 0.80

Tested by

no test coverage detected