Description: Use bettercap-caplets package. We packaged the bettercap-caplets so remove the install/update function for caplets and use the correct path to caplets:/usr/share/bettercap. Author: Sophie Brun Origin: Kali Linux, https://gitlab.com/kalilinux/packages/bettercap/-/blob/b97175cfd96369ca42aa931ac08eba81444586f4/debian/patches/disable-install-update-caplets.patch Forwarded: not-needed Reviewed-By: Francisco Vilmar Cardoso Ruviaro Last-Update: 2024-08-06 --- a/caplets/env.go +++ b/caplets/env.go @@ -19,7 +19,7 @@ func getDefaultInstallBase() string { if runtime.GOOS == "windows" { return filepath.Join(os.Getenv("ALLUSERSPROFILE"), "bettercap") } - return "/usr/local/share/bettercap/" + return "/usr/share/bettercap/" } func getUserHomeDir() string { --- a/modules/caplets/caplets.go +++ b/modules/caplets/caplets.go @@ -2,18 +2,13 @@ package caplets import ( "fmt" - "io" - "net/http" - "os" "github.com/bettercap/bettercap/caplets" "github.com/bettercap/bettercap/session" "github.com/dustin/go-humanize" - "github.com/evilsocket/islazy/fs" "github.com/evilsocket/islazy/tui" - "github.com/evilsocket/islazy/zip" ) type CapletsModule struct { @@ -36,12 +31,11 @@ func NewCapletsModule(s *session.Session) *CapletsModule { func(args []string) error { return mod.Paths() })) - mod.AddHandler(session.NewModuleHandler("caplets.update", "", - "Install/updates the caplets.", - func(args []string) error { - return mod.Update() - })) + "Install/updates the caplets.", + func(args []string) error { + return mod.Update() + })) return mod } @@ -51,7 +45,7 @@ func (mod *CapletsModule) Name() string { } func (mod *CapletsModule) Description() string { - return "A module to list and update caplets." + return "A module to list caplets." } func (mod *CapletsModule) Author() string { @@ -73,7 +67,7 @@ func (mod *CapletsModule) Start() error { func (mod *CapletsModule) Show() error { caplets := caplets.List() if len(caplets) == 0 { - return fmt.Errorf("no installed caplets on this system, use the caplets.update command to download them") + return fmt.Errorf("no installed caplets on this system, in Debian install bettercap-caplets package") } colNames := []string{ @@ -113,38 +107,6 @@ func (mod *CapletsModule) Paths() error { } func (mod *CapletsModule) Update() error { - if !fs.Exists(caplets.InstallBase) { - mod.Info("creating caplets install path %s ...", caplets.InstallBase) - if err := os.MkdirAll(caplets.InstallBase, os.ModePerm); err != nil { - return err - } - } - - out, err := os.Create(caplets.ArchivePath) - if err != nil { - return err - } - defer out.Close() - - mod.Info("downloading caplets from %s ...", caplets.InstallArchive) - - resp, err := http.Get(caplets.InstallArchive) - if err != nil { - return err - } - defer resp.Body.Close() - - if _, err := io.Copy(out, resp.Body); err != nil { - return err - } - - mod.Info("installing caplets to %s ...", caplets.InstallPath) - - if _, err = zip.Unzip(caplets.ArchivePath, caplets.InstallBase); err != nil { - return err - } - - os.RemoveAll(caplets.InstallPath) - - return os.Rename(caplets.InstallPathArchive, caplets.InstallPath) + mod.Info("this command is inactive in Debian. Install the Debian package bettercap-caplets to get the caplets") + return nil }