Debian Codegraph @

debian/patches/disable-install-update-caplets.patch

raw symbols SCIP
1 Description: Use bettercap-caplets package.
2 We packaged the bettercap-caplets so remove the install/update function
3 for caplets and use the correct path to caplets:/usr/share/bettercap.
4 Author: Sophie Brun <[email protected]>
5 Origin: Kali Linux, https://gitlab.com/kalilinux/packages/bettercap/-/blob/b97175cfd96369ca42aa931ac08eba81444586f4/debian/patches/disable-install-update-caplets.patch
6 Forwarded: not-needed
7 Reviewed-By: Francisco Vilmar Cardoso Ruviaro <[email protected]>
8 Last-Update: 2024-08-06
9
10 --- a/caplets/env.go
11 +++ b/caplets/env.go
12 @@ -19,7 +19,7 @@ func getDefaultInstallBase() string {
13 if runtime.GOOS == "windows" {
14 return filepath.Join(os.Getenv("ALLUSERSPROFILE"), "bettercap")
15 }
16 - return "/usr/local/share/bettercap/"
17 + return "/usr/share/bettercap/"
18 }
19
20 func getUserHomeDir() string {
21
22 --- a/modules/caplets/caplets.go
23 +++ b/modules/caplets/caplets.go
24 @@ -2,18 +2,13 @@ package caplets
25
26 import (
27 "fmt"
28 - "io"
29 - "net/http"
30 - "os"
31
32 "github.com/bettercap/bettercap/caplets"
33 "github.com/bettercap/bettercap/session"
34
35 "github.com/dustin/go-humanize"
36
37 - "github.com/evilsocket/islazy/fs"
38 "github.com/evilsocket/islazy/tui"
39 - "github.com/evilsocket/islazy/zip"
40 )
41
42 type CapletsModule struct {
43 @@ -36,12 +31,11 @@ func NewCapletsModule(s *session.Session) *CapletsModule {
44 func(args []string) error {
45 return mod.Paths()
46 }))
47 -
48 mod.AddHandler(session.NewModuleHandler("caplets.update", "",
49 - "Install/updates the caplets.",
50 - func(args []string) error {
51 - return mod.Update()
52 - }))
53 + "Install/updates the caplets.",
54 + func(args []string) error {
55 + return mod.Update()
56 + }))
57
58 return mod
59 }
60 @@ -51,7 +45,7 @@ func (mod *CapletsModule) Name() string {
61 }
62
63 func (mod *CapletsModule) Description() string {
64 - return "A module to list and update caplets."
65 + return "A module to list caplets."
66 }
67
68 func (mod *CapletsModule) Author() string {
69 @@ -73,7 +67,7 @@ func (mod *CapletsModule) Start() error {
70 func (mod *CapletsModule) Show() error {
71 caplets := caplets.List()
72 if len(caplets) == 0 {
73 - return fmt.Errorf("no installed caplets on this system, use the caplets.update command to download them")
74 + return fmt.Errorf("no installed caplets on this system, in Debian install bettercap-caplets package")
75 }
76
77 colNames := []string{
78 @@ -113,38 +107,6 @@ func (mod *CapletsModule) Paths() error {
79 }
80
81 func (mod *CapletsModule) Update() error {
82 - if !fs.Exists(caplets.InstallBase) {
83 - mod.Info("creating caplets install path %s ...", caplets.InstallBase)
84 - if err := os.MkdirAll(caplets.InstallBase, os.ModePerm); err != nil {
85 - return err
86 - }
87 - }
88 -
89 - out, err := os.Create(caplets.ArchivePath)
90 - if err != nil {
91 - return err
92 - }
93 - defer out.Close()
94 -
95 - mod.Info("downloading caplets from %s ...", caplets.InstallArchive)
96 -
97 - resp, err := http.Get(caplets.InstallArchive)
98 - if err != nil {
99 - return err
100 - }
101 - defer resp.Body.Close()
102 -
103 - if _, err := io.Copy(out, resp.Body); err != nil {
104 - return err
105 - }
106 -
107 - mod.Info("installing caplets to %s ...", caplets.InstallPath)
108 -
109 - if _, err = zip.Unzip(caplets.ArchivePath, caplets.InstallBase); err != nil {
110 - return err
111 - }
112 -
113 - os.RemoveAll(caplets.InstallPath)
114 -
115 - return os.Rename(caplets.InstallPathArchive, caplets.InstallPath)
116 + mod.Info("this command is inactive in Debian. Install the Debian package bettercap-caplets to get the caplets")
117 + return nil
118 }