tcp.modules - rhaidiz/bettercap GitHub Wiki
The tcp.proxy module can be scripted using javascript files that must declare at least one of the following functions:
// called when the script is loaded
function onLoad() {
}
// called when data is available
// return an array of bytes to override "data"
function onData(from, to, data) {
}
Modules can change the data buffer and return it, signaling the proxy to override the original buffer.
Builtin Functions
Modules can use the following builtin functions.
| function | description |
|---|---|
readFile("/path/to/file") |
Return the contents of a file as a string. |
log("message") |
Log a message in the interactive session (its level will be INFO). |
env("iface.ipv4") |
Read a variable. |
env("foo", "bar") |
Set a variable. |