0%

Bettercap project: install on local Ubuntu

install on Ubuntu

copy the shell script to install bettercap, then chmod +x, then run it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
anna@ubuntu1804:~$ ./bettercap.sh 
--2019-11-20 19:48:44-- https://github.com/bettercap/bettercap/releases/download/v2.26/bettercap_linux_amd64_v2.26.zip
Resolving github.com (github.com)... 192.30.255.113
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/116576783/09ae2a00-f1be-11e9-9887-8cb5e818dc9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191121T034844Z&X-Amz-Expires=300&X-Amz-Signature=622884cd807d933374563a875deaf3f0c5dd00788d6324e5b4fc5e07cc724198&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dbettercap_linux_amd64_v2.26.zip&response-content-type=application%2Foctet-stream [following]
--2019-11-20 19:48:44-- https://github-production-release-asset-2e65be.s3.amazonaws.com/116576783/09ae2a00-f1be-11e9-9887-8cb5e818dc9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191121T034844Z&X-Amz-Expires=300&X-Amz-Signature=622884cd807d933374563a875deaf3f0c5dd00788d6324e5b4fc5e07cc724198&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dbettercap_linux_amd64_v2.26.zip&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.25.140
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.25.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14037021 (13M) [application/octet-stream]
Saving to: ‘bettercap_linux_amd64_v2.26.zip’

bettercap_linux_amd64_v2.26.zip 100%[=================================================================>] 13.39M 1.39MB/s in 9.9s

2019-11-20 19:48:55 (1.35 MB/s) - ‘bettercap_linux_amd64_v2.26.zip’ saved [14037021/14037021]

Archive: bettercap_linux_amd64_v2.26.zip
inflating: bettercap
inflating: bettercap_linux_amd64_v2.26.sha256
[sudo] password for anna:


bettercap: error while loading shared libraries: libnetfilter_queue.so.1: cannot open shared object file: No such file or directory

It shows something wrong during installation, so I try the last command

1
2
anna@ubuntu1804:~$ sudo bettercap -eval "caplets.update; ui.update; quit"
bettercap: error while loading shared libraries: libnetfilter_queue.so.1: cannot open shared object file: No such file or directory

It shows I need to install libnetfilter-queue1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
anna@ubuntu1804:~$ sudo apt install libnetfilter-queue1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libnetfilter-queue1
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 11.4 kB of archives.
After this operation, 61.4 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libnetfilter-queue1 amd64 1.0.2-2 [11.4 kB]
Fetched 11.4 kB in 0s (42.2 kB/s)
Selecting previously unselected package libnetfilter-queue1.
(Reading database ... 219919 files and directories currently installed.)
Preparing to unpack .../libnetfilter-queue1_1.0.2-2_amd64.deb ...
Unpacking libnetfilter-queue1 (1.0.2-2) ...
Setting up libnetfilter-queue1 (1.0.2-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

After install this package, I run the command again, this time it works
The bettercap is installed successfully.

1
2
3
4
5
6
7
8
9
10
anna@ubuntu1804:~$ sudo bettercap -eval "caplets.update; ui.update; quit"
bettercap v2.26.1 (built for linux amd64 with go1.13.3) [type 'help' for a list of commands]

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

create systemd service file: /etc/systemd/system/bettercap.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=bettercap api.rest service.
Documentation=https://bettercap.org
Wants=network.target
After=pwngrid.service

[Service]
Type=simple
PermissionsStartOnly=true
ExecStart=/usr/bin/bettercap-launcher
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target

copy launch file to /usr/bin/bettercap-launcher

1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
/usr/bin/monstart
if [[ $(ifconfig | grep usb0 | grep RUNNING) ]] || [[ $(cat /sys/class/net/eth0/carrier) ]]; then
# if override file exists, go into auto mode
if [ -f /root/.pwnagotchi-auto ]; then
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0
fi
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
fi

After these steps, I want to start bettercap servive
first I want to run bettercap-luncher

1
2
3
4
5
6
root@ubuntu1804:/usr/bin# ./bettercap-launcher 
./bettercap-launcher: line 2: /usr/bin/monstart: No such file or directory
cat: /sys/class/net/eth0/carrier: No such file or directory
bettercap v2.26.1 (built for linux amd64 with go1.13.3) [type 'help' for a list of commands]

no interface matching 'mon0' found.

google monstart, it said it is based on kali linux, not Ubuntu.

1
2
3
4
5
6
root@ubuntu1804:/usr/bin# dpkg -l |grep kali
root@ubuntu1804:/usr/bin# apt install monstart
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package monstart

so monstart can not be install on Ubuntu.

try to start bettercap service, it is supposed to be failed.

1
2
3
4
5
6
7
8
9
10
11
12
root@ubuntu1804:/usr/bin# systemctl enable bettercap
Created symlink /etc/systemd/system/multi-user.target.wants/bettercap.service → /etc/systemd/system/bettercap.service.
root@ubuntu1804:/usr/bin# systemctl start bettercap
root@ubuntu1804:/usr/bin# systemctl status bettercap
● bettercap.service - bettercap api.rest service.
Loaded: loaded (/etc/systemd/system/bettercap.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2019-11-22 12:38:59 PST; 4s ago
Docs: https://bettercap.org
Process: 25242 ExecStart=/usr/bin/bettercap-launcher (code=exited, status=203/EXEC)
Main PID: 25242 (code=exited, status=203/EXEC)

Nov 22 12:38:59 ubuntu1804 systemd[1]: bettercap.service: Failed with result 'exit-code'.

Conclusion: can not run bettercap on local Ubuntu since some command missing.