0%

Bettercap project: install on raspberry Pi

install on raspberry Pi3B+

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@treehouses:~# sudo apt update
Hit:1 https://download.docker.com/linux/raspbian stretch InRelease
Get:2 http://archive.raspberrypi.org/debian buster InRelease [25.2 kB]
Hit:3 https://deb.nodesource.com/node_10.x buster InRelease
Get:4 http://deb.torproject.org/torproject.org buster InRelease [4,964 B]
Get:5 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:6 https://packages.cloud.google.com/apt coral-cloud-stable InRelease [6,328 B]
Get:7 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:8 http://archive.raspberrypi.org/debian buster/main armhf Packages [259 kB]
Ign:9 https://packages.cloud.google.com/apt coral-cloud-stable/main armhf Packages
Get:9 https://packages.cloud.google.com/apt coral-cloud-stable/main armhf Packages [3,358 B]
Fetched 13.3 MB in 25s (539 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
53 packages can be upgraded. Run 'apt list --upgradable' to see them.

next

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
root@treehouses:~# sudo apt install golang git build-essential libpcap-dev libusb-1.0-0-dev libnetfilter-queue-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.6).
git is already the newest version (1:2.20.1-2).
The following package was automatically installed and is no longer required:
point-rpi
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src libnfnetlink-dev libpcap0.8-dev libusb-1.0-doc
Suggested packages:
bzr | brz mercurial subversion
The following NEW packages will be installed:
golang golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src libnetfilter-queue-dev libnfnetlink-dev
libpcap-dev libpcap0.8-dev libusb-1.0-0-dev libusb-1.0-doc
0 upgraded, 14 newly installed, 0 to remove and 53 not upgraded.
Need to get 52.4 MB of archives.
After this operation, 260 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-src armhf 1.11.6-1+rpi1+deb10u2 [13.0 MB]
Get:2 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-go armhf 1.11.6-1+rpi1+deb10u2 [36.3 MB]
Get:3 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-doc all 1.11.6-1+rpi1+deb10u2 [2,517 kB]
Get:4 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11 all 1.11.6-1+rpi1+deb10u2 [24.1 kB]
Get:5 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-src armhf 2:1.11~1+b6 [4,660 B]
Get:6 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-go armhf 2:1.11~1+b6 [23.7 kB]
Get:7 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-doc all 2:1.11~1 [4,392 B]
Get:8 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang armhf 2:1.11~1+b6 [4,612 B]
Get:9 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libnfnetlink-dev armhf 1.0.1-3 [7,928 B]
Get:10 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libnetfilter-queue-dev armhf 1.0.3-1 [6,548 B]
Get:11 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libpcap0.8-dev armhf 1.8.1-6 [220 kB]
Get:12 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libpcap-dev armhf 1.8.1-6 [25.9 kB]
Get:13 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libusb-1.0-0-dev armhf 2:1.0.22-2 [65.5 kB]
Get:14 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libusb-1.0-doc all 2:1.0.22-2 [182 kB]
Fetched 52.4 MB in 23s (2,250 kB/s)
Selecting previously unselected package golang-1.11-src.
(Reading database ... 154643 files and directories currently installed.)
Preparing to unpack .../00-golang-1.11-src_1.11.6-1+rpi1+deb10u2_armhf.deb ...
Unpacking golang-1.11-src (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11-go.
Preparing to unpack .../01-golang-1.11-go_1.11.6-1+rpi1+deb10u2_armhf.deb ...
Unpacking golang-1.11-go (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11-doc.
Preparing to unpack .../02-golang-1.11-doc_1.11.6-1+rpi1+deb10u2_all.deb ...
Unpacking golang-1.11-doc (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11.
Preparing to unpack .../03-golang-1.11_1.11.6-1+rpi1+deb10u2_all.deb ...
Unpacking golang-1.11 (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-src.
Preparing to unpack .../04-golang-src_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang-src (2:1.11~1+b6) ...
Selecting previously unselected package golang-go.
Preparing to unpack .../05-golang-go_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang-go (2:1.11~1+b6) ...
Selecting previously unselected package golang-doc.
Preparing to unpack .../06-golang-doc_2%3a1.11~1_all.deb ...
Unpacking golang-doc (2:1.11~1) ...
Selecting previously unselected package golang.
Preparing to unpack .../07-golang_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang (2:1.11~1+b6) ...
Selecting previously unselected package libnfnetlink-dev.
Preparing to unpack .../08-libnfnetlink-dev_1.0.1-3_armhf.deb ...
Unpacking libnfnetlink-dev (1.0.1-3) ...
Selecting previously unselected package libnetfilter-queue-dev.
Preparing to unpack .../09-libnetfilter-queue-dev_1.0.3-1_armhf.deb ...
Unpacking libnetfilter-queue-dev (1.0.3-1) ...
Selecting previously unselected package libpcap0.8-dev:armhf.
Preparing to unpack .../10-libpcap0.8-dev_1.8.1-6_armhf.deb ...
Unpacking libpcap0.8-dev:armhf (1.8.1-6) ...
Selecting previously unselected package libpcap-dev:armhf.
Preparing to unpack .../11-libpcap-dev_1.8.1-6_armhf.deb ...
Unpacking libpcap-dev:armhf (1.8.1-6) ...
Selecting previously unselected package libusb-1.0-0-dev:armhf.
Preparing to unpack .../12-libusb-1.0-0-dev_2%3a1.0.22-2_armhf.deb ...
Unpacking libusb-1.0-0-dev:armhf (2:1.0.22-2) ...
Selecting previously unselected package libusb-1.0-doc.
Preparing to unpack .../13-libusb-1.0-doc_2%3a1.0.22-2_all.deb ...
Unpacking libusb-1.0-doc (2:1.0.22-2) ...
Setting up libnfnetlink-dev (1.0.1-3) ...
Setting up golang-1.11-src (1.11.6-1+rpi1+deb10u2) ...
Setting up libpcap0.8-dev:armhf (1.8.1-6) ...
Setting up libusb-1.0-doc (2:1.0.22-2) ...
Setting up libusb-1.0-0-dev:armhf (2:1.0.22-2) ...
Setting up golang-1.11-go (1.11.6-1+rpi1+deb10u2) ...
Setting up libnetfilter-queue-dev (1.0.3-1) ...
Setting up golang-src (2:1.11~1+b6) ...
Setting up libpcap-dev:armhf (1.8.1-6) ...
Setting up golang-1.11-doc (1.11.6-1+rpi1+deb10u2) ...
Setting up golang-go (2:1.11~1+b6) ...
Setting up golang-1.11 (1.11.6-1+rpi1+deb10u2) ...
Setting up golang-doc (2:1.11~1) ...
Setting up golang (2:1.11~1+b6) ...
Processing triggers for man-db (2.8.5-2) ...

next

1
root@treehouses:~# go get -u github.com/bettercap/bettercap

Once the build process is concluded, the binary will be located in go/bin/bettercap
I checked the go/bin/bettercap

1
2
root@treehouses:~# which go/bin/bettercap
go/bin/bettercap

start bettercap

need to make sure bettercap command under /usr/bin

1
2
3
root@treehouses:~# cp go/bin/bettercap /usr/bin
root@treehouses:~# which bettercap
/usr/bin/bettercap

run following command

1
2
3
4
5
6
7
8
9
10
root@treehouses:~# bettercap -eval "caplets.update; ui.update; q"
bettercap v2.26.1 (built for linux arm with go1.11.6) [type 'help' for a list of commands]

[00:07:08] [sys.log] [inf] caplets creating caplets install path /usr/local/share/bettercap/ ...
[00:07:08] [sys.log] [inf] caplets downloading caplets from https://github.com/bettercap/caplets/archive/master.zip ...
[00:07:10] [sys.log] [inf] caplets installing caplets to /usr/local/share/bettercap/caplets ...
[00:07:10] [sys.log] [inf] ui checking latest stable release ...
[00:07:10] [sys.log] [inf] ui downloading ui v1.3.0 from https://github.com/bettercap/ui/releases/download/v1.3.0/ui.zip ...
[00:07:14] [sys.log] [inf] ui installing to /usr/local/share/bettercap/ui ...
[00:07:18] [sys.log] [inf] ui installation complete, you can now run the http-ui (or https-ui) caplet to start the UI.

Inorder to login to web UI, I need do check this first

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root@treehouses:~ $ cat /usr/local/share/bettercap/caplets/https-ui.cap
# api listening on https://0.0.0.0:8083/ and ui on https://0.0.0.0
set api.rest.address 0.0.0.0
set api.rest.port 8083
set https.server.address 0.0.0.0
set https.server.port 443

## make sure both use the same https certificate so api requests won't fail
set https.server.certificate ~/.bettercap-https.cert.pem
set https.server.key ~/.bettercap-https.key.pem
set api.rest.certificate ~/.bettercap-https.cert.pem
set api.rest.key ~/.bettercap-https.key.pem
# default installation path of the ui
set https.server.path /usr/local/share/bettercap/ui

# !!! CHANGE THESE !!!
set api.rest.username user
set api.rest.password pass

# go!
api.rest on
https.server on

start bettercap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
root@treehouses:~# bettercap -caplet https-ui
bettercap v2.26.1 (built for linux arm with go1.11.6) [type 'help' for a list of commands]

[00:17:17] [sys.log] [inf] api.rest generating TLS key to /root/.bettercap-https.key.pem
[00:17:17] [sys.log] [inf] api.rest generating TLS certificate to /root/.bettercap-https.cert.pem
192.168.0.0/24 > 192.168.0.33 » [00:18:44] [sys.log] [inf] https.server loading server TLS certificate from /root/.bettercap-https.cert.pem
192.168.0.0/24 > 192.168.0.33 » [00:18:44] [sys.log] [inf] https.server loading server TLS key from /root/.bettercap-https.key.pem
192.168.0.0/24 > 192.168.0.33 » [00:18:44] [sys.log] [inf] https.server starting on https://0.0.0.0:443
192.168.0.0/24 > 192.168.0.33 » [00:18:44] [sys.log] [inf] api.rest api server starting on https://0.0.0.0:8083
192.168.0.0/24 > 192.168.0.33 » 2019/11/23 00:20:07 http: TLS handshake error from 192.168.0.126:46472: remote error: tls: unknown certificate
2019/11/23 00:20:07 http: TLS handshake error from 192.168.0.126:46474: remote error: tls: unknown certificate
2019/11/23 00:20:08 http: TLS handshake error from 192.168.0.126:46486: remote error: tls: unknown certificate
2019/11/23 00:20:08 http: TLS handshake error from 192.168.0.126:46488: remote error: tls: unknown certificate
2019/11/23 00:20:14 http: TLS handshake error from 192.168.0.126:46528: remote error: tls: unknown certificate
2019/11/23 00:20:14 http: TLS handshake error from 192.168.0.126:46530: remote error: tls: unknown certificate
2019/11/23 00:20:21 http: TLS handshake error from 192.168.0.126:46574: remote error: tls: unknown certificate
2019/11/23 00:20:21 http: TLS handshake error from 192.168.0.126:46576: remote error: tls: unknown certificate
2019/11/23 00:20:53 http: TLS handshake error from 192.168.0.126:60944: remote error: tls: unknown certificate

then login https://192.168.0.33, using username and password