| 1 |
package capletsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/ |
| 2 |
|
| 3 |
import ( |
| 4 |
"osscip-go gomod github.com/golang/go/src go1.16 os/" |
| 5 |
"path/filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/" |
| 6 |
"runtimescip-go gomod github.com/golang/go/src go1.16 runtime/" |
| 7 |
|
| 8 |
"github.com/evilsocket/islazy/strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/" |
| 9 |
"github.com/mitchellh/go-homedirscip-go gomod github.com/mitchellh/go-homedir v1.1.0 `github.com/mitchellh/go-homedir`/" |
| 10 |
) |
| 11 |
|
| 12 |
const ( |
| 13 |
EnvVarNamescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/EnvVarName. = "CAPSPATH" |
| 14 |
Suffixscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/Suffix. = ".cap" |
| 15 |
InstallArchivescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallArchive. = "https://github.com/bettercap/caplets/archive/master.zip" |
| 16 |
) |
| 17 |
|
| 18 |
func getDefaultInstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/getDefaultInstallBase().() string { |
| 19 |
if runtimescip-go gomod github.com/golang/go/src go1.16 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.16 runtime/GOOS. == "windows" { |
| 20 |
return filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Join().(osscip-go gomod github.com/golang/go/src go1.16 os/.Getenvscip-go gomod github.com/golang/go/src go1.16 os/Getenv().("ALLUSERSPROFILE"), "bettercap") |
| 21 |
} |
| •22 |
return "/usr/share/bettercap/" |
| 23 |
} |
| 24 |
|
| 25 |
func getUserHomeDirscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/getUserHomeDir().() string { |
| 26 |
usr, _ := homedirscip-go gomod github.com/mitchellh/go-homedir v1.1.0 `github.com/mitchellh/go-homedir`/.Dirscip-go gomod github.com/mitchellh/go-homedir v1.1.0 `github.com/mitchellh/go-homedir`/Dir().() |
| 27 |
return usr |
| 28 |
} |
| 29 |
|
| 30 |
var ( |
| 31 |
InstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallBase. = "" |
| 32 |
InstallPathArchivescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallPathArchive. = "" |
| 33 |
InstallPathscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallPath. = "" |
| 34 |
ArchivePathscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/ArchivePath. = "" |
| 35 |
LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths. = []string(nil) |
| 36 |
) |
| 37 |
|
| 38 |
func Setupscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/Setup().(base string) error { |
| 39 |
InstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallBase. = base |
| 40 |
InstallPathArchivescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallPathArchive. = filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Join().(InstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallBase., "caplets-master") |
| 41 |
InstallPathscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallPath. = filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Join().(InstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallBase., "caplets") |
| 42 |
ArchivePathscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/ArchivePath. = filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Join().(osscip-go gomod github.com/golang/go/src go1.16 os/.TempDirscip-go gomod github.com/golang/go/src go1.16 os/TempDir().(), "caplets.zip") |
| 43 |
|
| 44 |
LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths. = []string{ |
| 45 |
"./", |
| 46 |
"./caplets/", |
| 47 |
InstallPathscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/InstallPath., |
| 48 |
filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Join().(getUserHomeDirscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/getUserHomeDir().(), "caplets"), |
| 49 |
} |
| 50 |
|
| 51 |
for _, path := range strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/.SplitByscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/SplitBy().(strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/.Trimscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/Trim().(osscip-go gomod github.com/golang/go/src go1.16 os/.Getenvscip-go gomod github.com/golang/go/src go1.16 os/Getenv().(EnvVarNamescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/EnvVarName.)), string(osscip-go gomod github.com/golang/go/src go1.16 os/.PathListSeparatorscip-go gomod github.com/golang/go/src go1.16 os/PathListSeparator.)) { |
| 52 |
if path = strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/.Trimscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/Trim().(path); len(path) > 0 { |
| 53 |
LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths. = append(LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths., path) |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
for i, path := range LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths. { |
| 58 |
LoadPathsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/LoadPaths.[i], _ = filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Absscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Abs().(path) |
| 59 |
} |
| 60 |
|
| 61 |
return nil |
| 62 |
} |
| 63 |
|
| 64 |
func initscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/init().() { |
| 65 |
// init with defaults |
| 66 |
Setupscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/Setup().(getDefaultInstallBasescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/caplets`/getDefaultInstallBase().()) |
| 67 |
} |