Bettercap: Uncaught errors for empty variables in caplet files unless -debug is enabled

Created on 19 Mar 2018  Â·  3Comments  Â·  Source: bettercap/bettercap

If we don't include a value when setting a variable in a .cap file, the entire caplet is ignored, and no errors are shown (only with -debug).

Environment

Please provide:

  • Bettercap version you are using.
    v2.2
  • OS version and architecture you are using.
    Linux ghxst 4.14.0-kali3-amd64 #1 SMP Debian 4.14.17-1kali1 (2018-02-16) x86_64 GNU/Linux
  • Go version if building from sources.
    go1.10rc2 linux/amd64
  • Command line arguments you are using.
    sudo bettercap -caplet caplets/issue187.cap
  • Caplet code you are using or the interactive session commands.
# test if the code prior is included or ignored
http.server on

# set an empty value
set http.proxy.port 

# try starting a module
http.proxy on
  • Full debug output while reproducing the issue ( bettercap -debug ... ).

Command:
sudo bettercap -caplet caplets/issue187.cap -debug

Output:

[12:51:24] [mod.started] net.recon
[12:51:24] [mod.started] update
[12:51:24] [sys.log] [err] Error while runnig caplet /root/caplets/issue187.cap: Unknown or invalid syntax "set http.proxy.port", type help for the help menu.
192.168.1.0/24 > 192.168.1.19  » [12:51:25] [sys.log] [inf] You are running 2.2 which is the latest stable version.
192.168.1.0/24 > 192.168.1.19  » [12:51:25] [mod.stopped] update

Steps to Reproduce

  1. Save the following code (issue187.cap)
# test if the code prior is included or ignored
http.server on

# set an empty value
set http.proxy.port 

# try starting a module
http.proxy on
  1. Run sudo bettercap -caplet caplets/issue187.cap
  2. As you can see, no matter how long we wait, no errors are shown, and no http server or proxy is started.

Expected behavior: It throws a warning and sticks to the default value (and also warns the user that this has happened).

Actual behavior: WIthout using -debug, no errors are shown, and no caplet code is executed.

--

♥ ANY INCOMPLETE REPORT WILL BE CLOSED RIGHT AWAY ♥

bug

All 3 comments

stupid autocomment hotkeys...

updated :+1:

So, this is not -exactly- what it seems (not realted to -debug at all :D), what it happens is that the events.stream is started but, if an error occurs just after it started, the log event will not be printed (and -this- is the bug).

This commit just fixes the events.stream so that the logs are correctly buffered and then printed :)

Was this page helpful?
0 / 5 - 0 ratings