From 31c0f61a12b9dd175cea0ff5eba9658c82b1c19d Mon Sep 17 00:00:00 2001 From: "termux-actions[bot]" Date: Wed, 20 Apr 2022 10:39:57 +0000 Subject: [PATCH] root-packages/bettercap --- root-packages/bettercap/build.sh | 29 ++++++++++++++++ root-packages/bettercap/fix-home-path.patch | 38 +++++++++++++++++++++ root-packages/bettercap/fix-paths.patch | 26 ++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 root-packages/bettercap/build.sh create mode 100644 root-packages/bettercap/fix-home-path.patch create mode 100644 root-packages/bettercap/fix-paths.patch diff --git a/root-packages/bettercap/build.sh b/root-packages/bettercap/build.sh new file mode 100644 index 0000000000..2fc446e9b9 --- /dev/null +++ b/root-packages/bettercap/build.sh @@ -0,0 +1,29 @@ +TERMUX_PKG_HOMEPAGE=https://www.bettercap.org +TERMUX_PKG_DESCRIPTION="The Swiss Army knife for 802.11, BLE and Ethernet networks reconnaissance and MITM attacks" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=2.32.0 +TERMUX_PKG_REVISION=1 +TERMUX_PKG_SRCURL=https://github.com/bettercap/bettercap/archive/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=ea28d4d533776a328a54723a74101d1720016ffe7d434bf1d7ab222adb397ac6 +TERMUX_PKG_DEPENDS="libpcap, libusb, libnetfilter-queue" + +termux_step_configure() { + termux_setup_golang + export GOPATH=$TERMUX_PKG_BUILDDIR + export CGO_CFLAGS="-I$TERMUX_PREFIX/include" + + mkdir -p "$GOPATH"/src/github.com/bettercap/ + cp -a "$TERMUX_PKG_SRCDIR" "$GOPATH"/src/github.com/bettercap/bettercap + go get github.com/bettercap/recording +} + +termux_step_make() { + cd src/github.com/bettercap/bettercap + make build +} + +termux_step_make_install() { + cd src/github.com/bettercap/bettercap + make install +} diff --git a/root-packages/bettercap/fix-home-path.patch b/root-packages/bettercap/fix-home-path.patch new file mode 100644 index 0000000000..01e8c989e8 --- /dev/null +++ b/root-packages/bettercap/fix-home-path.patch @@ -0,0 +1,38 @@ +diff --git a/modules/https_proxy/https_proxy.go b/modules/https_proxy/https_proxy.go +index 06bc1e0..127bb39 100644 +--- a/modules/https_proxy/https_proxy.go ++++ b/modules/https_proxy/https_proxy.go +@@ -47,12 +47,12 @@ func NewHttpsProxy(s *session.Session) *HttpsProxy { + "URL, path or javascript code to inject into every HTML page.")) + + mod.AddParam(session.NewStringParameter("https.proxy.certificate", +- "~/.bettercap-ca.cert.pem", ++ "@TERMUX_HOME@/.bettercap-ca.cert.pem", + "", + "HTTPS proxy certification authority TLS certificate file.")) + + mod.AddParam(session.NewStringParameter("https.proxy.key", +- "~/.bettercap-ca.key.pem", ++ "@TERMUX_HOME@/.bettercap-ca.key.pem", + "", + "HTTPS proxy certification authority TLS key file.")) + +diff --git a/modules/https_server/https_server.go b/modules/https_server/https_server.go +index 0d9ff80..3e49996 100644 +--- a/modules/https_server/https_server.go ++++ b/modules/https_server/https_server.go +@@ -42,12 +42,12 @@ func NewHttpsServer(s *session.Session) *HttpsServer { + "Port to bind the http server to.")) + + mod.AddParam(session.NewStringParameter("https.server.certificate", +- "~/.bettercap-httpd.cert.pem", ++ "@TERMUX_HOME@/.bettercap-httpd.cert.pem", + "", + "TLS certificate file (will be auto generated if filled but not existing).")) + + mod.AddParam(session.NewStringParameter("https.server.key", +- "~/.bettercap-httpd.key.pem", ++ "@TERMUX_HOME@/.bettercap-httpd.key.pem", + "", + "TLS key file (will be auto generated if filled but not existing).")) + diff --git a/root-packages/bettercap/fix-paths.patch b/root-packages/bettercap/fix-paths.patch new file mode 100644 index 0000000000..372c6a91f8 --- /dev/null +++ b/root-packages/bettercap/fix-paths.patch @@ -0,0 +1,26 @@ +diff --git a/caplets/env.go b/caplets/env.go +index 9ba8706..fd12078 100644 +--- 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 "@TERMUX_PREFIX@/share/bettercap/" + } + + func getUserHomeDir() string { +diff --git a/modules/ui/ui.go b/modules/ui/ui.go +index 7bc5270..9a5476a 100644 +--- a/modules/ui/ui.go ++++ b/modules/ui/ui.go +@@ -34,7 +34,7 @@ func getDefaultInstallBase() string { + if runtime.GOOS == "windows" { + return filepath.Join(os.Getenv("ALLUSERSPROFILE"), "bettercap") + } +- return "/usr/local/share/bettercap/" ++ return "@TERMUX_PREFIX@/share/bettercap/" + } + + func NewUIModule(s *session.Session) *UIModule {